I am using react-native-webview-quilljs
to render formatted HTML text. It works fine on Android and iOS but it isn't supported on the Web (i.e. react-native-web
/expo-web
). So I managed to strip the HTML tags when rendering the formatted string on the browser (i.e. rendering non formatted text).
Then I got to realise that react-native-web
actually uses React
to render react-native
components on the browser. And React has something as dangerouslySetInnerHTML
that allows injecting HTML string to be rendered directly on the browser.
So, is there a way to use dangerouslySetInnerHTML
from the react-native
/ expo
project.
Upon close inspection I found that the html tags gets converted to the html entities while rendering on the browser. Take a look at the image below.
Solved it (would rather call it a workaround) by rendering a
<div>
withdangerouslySetInnerHTML
prop whenPlatform.OS === 'web'
.Example: