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 2626 },
2727 "web" : {
2828 "favicon" : " ./assets/favicon.png"
29+ },
30+ "experiments" : {
31+ "reactCompiler" : true
2932 }
3033 }
3134}
Original file line number Diff line number Diff line change 1212 },
1313 "dependencies" : {
1414 "@expo/metro-runtime" : " ~5.0.4" ,
15+ "babel-plugin-react-compiler" : " ^19.0.0-beta-af1b7da-20250417" ,
1516 "expo" : " ^53.0.13" ,
1617 "expo-status-bar" : " ~2.2.3" ,
1718 "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:
16821682 dependencies :
16831683 " @babel/helper-define-polyfill-provider" " ^0.6.3"
16841684
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+
16851692babel-plugin-react-native-web@~0.19.13 :
16861693 version "0.19.13"
16871694 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" ;
41import Slugger from "github-slugger" ;
52import React , { type ReactNode } from "react" ;
63import {
@@ -14,6 +11,7 @@ import {
1411 type ViewStyle ,
1512} from "react-native" ;
1613import MDImage from "./../components/MDImage" ;
14+ import MDList from "./../components/MDList" ;
1715import MDSvg from "./../components/MDSvg" ;
1816import MDTable from "./../components/MDTable" ;
1917import { onLinkPress } from "../utils/handlers" ;
@@ -80,15 +78,14 @@ class Renderer implements RendererInterface {
8078 startIndex ?: number ,
8179 ) : ReactNode {
8280 return (
83- < MarkedList
84- counterRenderer = { ordered ? Decimal : Disc }
85- markerTextStyle = { textStyle }
86- markerBoxStyle = { listStyle }
81+ < MDList
8782 key = { this . getKey ( ) }
83+ ordered = { ordered }
84+ li = { li }
85+ listStyle = { listStyle }
86+ textStyle = { textStyle }
8887 startIndex = { startIndex }
89- >
90- { li . map ( ( node ) => node ) }
91- </ MarkedList >
88+ />
9289 ) ;
9390 }
9491
You can’t perform that action at this time.
0 commit comments