acornjs / acorn-jsx

Alternative, faster React.js JSX parser
MIT License
651 stars 74 forks source link

Does it work for react-native #111

Closed ghost closed 4 years ago

ghost commented 4 years ago

I am strongly need a package to convert String into JSX, is this package works for react-native too?

cawfree commented 4 years ago

react-jsx-parser works on RN. You just need to set the renderInWrapper prop to false.

ghost commented 4 years ago

sorry does not work for me with or without renderInWrapper={false}

cawfree commented 4 years ago

Maybe it's the version I was using.

How about if you use "react-jsx-parser": "1.16.1"?

ghost commented 4 years ago

I am using latest version, and this is the string I am going to parse it.

const strJSX = "<Text onPress={()=> alert('Hi I am parsed')} style={{color: 'red', lineHeight: '40', borderRadius: 20, margin: 5, padding: 5, fontWeight: 'bold'}}>Hi dear this is a jsx string</Text>";

Could you please test the above string and parse it to react-native jsx?

RReverser commented 4 years ago

Sorry, but this doesn't seem to be an issue. For questions and discussions, please use StackOverflow or https://discuss.ternjs.net/c/acorn.

ghost commented 4 years ago

@RReverser thank you