File tree Expand file tree Collapse file tree 6 files changed +999
-1176
lines changed
examples/react-native-marked-sample Expand file tree Collapse file tree 6 files changed +999
-1176
lines changed Original file line number Diff line number Diff line change 26
26
},
27
27
"web" : {
28
28
"favicon" : " ./assets/favicon.png"
29
+ },
30
+ "experiments" : {
31
+ "reactCompiler" : true
29
32
}
30
33
}
31
34
}
Original file line number Diff line number Diff line change 12
12
},
13
13
"dependencies" : {
14
14
"@expo/metro-runtime" : " ~5.0.4" ,
15
+ "babel-plugin-react-compiler" : " ^19.0.0-beta-af1b7da-20250417" ,
15
16
"expo" : " ^53.0.13" ,
16
17
"expo-status-bar" : " ~2.2.3" ,
17
18
"react" : " 19.0.0" ,
Original file line number Diff line number Diff line change @@ -1682,6 +1682,13 @@ babel-plugin-polyfill-regenerator@^0.6.1:
1682
1682
dependencies :
1683
1683
" @babel/helper-define-polyfill-provider" " ^0.6.3"
1684
1684
1685
+ babel-plugin-react-compiler@^19.0.0-beta-af1b7da-20250417 :
1686
+ version "19.0.0-beta-af1b7da-20250417"
1687
+ resolved "https://registry.yarnpkg.com/babel-plugin-react-compiler/-/babel-plugin-react-compiler-19.0.0-beta-af1b7da-20250417.tgz#b87eb8c306f3d16bf20dfbba76a097fa82555566"
1688
+ integrity sha512-UyTCRmzpxa4H1EqJk8fWeUOzHdEA12NQZ5DrF5hyhCs+Y6f7B4pg1fkul49sRn9GPPGFgkrH4IxOtnQJ7tNXIA==
1689
+ dependencies :
1690
+ " @babel/types" " ^7.26.0"
1691
+
1685
1692
babel-plugin-react-native-web@~0.19.13 :
1686
1693
version "0.19.13"
1687
1694
resolved "https://registry.yarnpkg.com/babel-plugin-react-native-web/-/babel-plugin-react-native-web-0.19.13.tgz#bf919bd6f18c4689dd1a528a82bda507363b953d"
Original file line number Diff line number Diff line change
1
+ import Decimal from "@jsamr/counter-style/presets/decimal" ;
2
+ import Disc from "@jsamr/counter-style/presets/disc" ;
3
+ import { MarkedListItem , useMarkedList } from "@jsamr/react-native-li" ;
4
+ import React , {
5
+ Fragment ,
6
+ type FunctionComponent ,
7
+ memo ,
8
+ type ReactNode ,
9
+ } from "react" ;
10
+ import type { TextStyle , ViewStyle } from "react-native" ;
11
+
12
+ type MDListProps = {
13
+ ordered : boolean ;
14
+ li : ReactNode [ ] ;
15
+ listStyle ?: ViewStyle ;
16
+ textStyle ?: TextStyle ;
17
+ startIndex ?: number ;
18
+ } ;
19
+
20
+ const MDList : FunctionComponent < MDListProps > = ( {
21
+ ordered,
22
+ li,
23
+ listStyle,
24
+ textStyle,
25
+ startIndex,
26
+ } ) => {
27
+ const listProps = useMarkedList ( {
28
+ counterRenderer : ordered ? Decimal : Disc ,
29
+ startIndex : startIndex ,
30
+ markerTextStyle : textStyle ,
31
+ markerBoxStyle : listStyle ,
32
+ length : li . length ,
33
+ } ) ;
34
+
35
+ return (
36
+ < Fragment >
37
+ { li . map ( ( node , index ) => (
38
+ < MarkedListItem key = { index } index = { index } { ...listProps } >
39
+ { node }
40
+ </ MarkedListItem >
41
+ ) ) }
42
+ </ Fragment >
43
+ ) ;
44
+ } ;
45
+
46
+ export default memo ( MDList ) ;
Original file line number Diff line number Diff line change 1
- import Decimal from "@jsamr/counter-style/presets/decimal" ;
2
- import Disc from "@jsamr/counter-style/presets/disc" ;
3
- import MarkedList from "@jsamr/react-native-li" ;
4
1
import Slugger from "github-slugger" ;
5
2
import React , { type ReactNode } from "react" ;
6
3
import {
@@ -14,6 +11,7 @@ import {
14
11
type ViewStyle ,
15
12
} from "react-native" ;
16
13
import MDImage from "./../components/MDImage" ;
14
+ import MDList from "./../components/MDList" ;
17
15
import MDSvg from "./../components/MDSvg" ;
18
16
import MDTable from "./../components/MDTable" ;
19
17
import { onLinkPress } from "../utils/handlers" ;
@@ -80,15 +78,14 @@ class Renderer implements RendererInterface {
80
78
startIndex ?: number ,
81
79
) : ReactNode {
82
80
return (
83
- < MarkedList
84
- counterRenderer = { ordered ? Decimal : Disc }
85
- markerTextStyle = { textStyle }
86
- markerBoxStyle = { listStyle }
81
+ < MDList
87
82
key = { this . getKey ( ) }
83
+ ordered = { ordered }
84
+ li = { li }
85
+ listStyle = { listStyle }
86
+ textStyle = { textStyle }
88
87
startIndex = { startIndex }
89
- >
90
- { li . map ( ( node ) => node ) }
91
- </ MarkedList >
88
+ />
92
89
) ;
93
90
}
94
91
You can’t perform that action at this time.
0 commit comments