Reputation: 11
I have a react native component string.
const str = '<View style={{'width':200, 'height':50, 'backgroundColor':'blue'}}>';
I want to change this string to react native element. I render this string like this.
<Text>{str}</Text>
It is returning only text.
Actually, I want the result like this. How to convert the string element to react native component?
Upvotes: 0
Views: 242
Reputation: 430
You can use React Native WebView.
<WebView
originWhitelist={['*']}
source={{ html: str }}
/>
https://github.com/react-native-webview/react-native-webview
Upvotes: -1