style={{flex : 1))
html={content}
/>
The problem is that if someone clicks on the link, it will open in the app, I would rather force it to use the link in Safari Open in. Is that possible?
1) Register your own that is handled by your application URL scheme. For example. to myApp: //this/is/a/link.html. Then process all incoming events of the scheme and make corresponding calls to the API. The registration plan is simple and the effect is very good. This is for me Said seems to be the most powerful method.
2) Use a library to let Webview directly talk to its paren view. For example. https://github.com/alinz/react-native-webview- bridge. Then put some JS code in the page, onClick sends the link URL to the parent view, and then calls the API. I just used that project and it worked as a charm until I needed an RN upgrade to break it. But It is still under active development, so you should be fine.
I have a WebView component that loads static HTML content:
style={{flex: 1}}
html={content}
/>
The problem is that if someone clicks on the link, it Will open in the app, I would rather force it to use a link to open in Safari. Is that possible?
After searching a bit, I saw that the only way to open the browser from the RN application is to use Linking or LinkingIOS API. So the question is, how to make Your Webview can use this API. There are two possible solutions:
1) Register your own URL scheme handled by your application. For example. For myApp: //this/ is/a/link.html. Then process all incoming events of the program and make corresponding calls to the API. The registration plan is simple and works well. This seems to be the most powerful method to me.
2) Use a library to let Webview directly talk to its paren view. For example. https://github.com/alinz/react-native-webview-bridge. Then put some JS code in the page, onClick sends the link URL to the parent view, and then calls the API. I just used that project and it worked as a charm until I needed an RN upgrade to break it. But it is still under active development, so you should be fine. < /p>