简体   繁体   中英

Use existing WebView JavascriptInterface with React-Native

Can I use existent javascript interface, currently attached to the WebView in my android and iOS projects, within React-Native app?

React-Native does not use WebView for itself to run. But I can create it React WebView . My question is about using existing javascript interface, perhabs attach it to the created in React-Native WebView, make some sort of React extension etc...

BACKGROUND:

I have several android and ios applications made using WebView. For WebView there is a javascript interface (same for all apps), that I use to access native device environment features (like Cordova/Phonegap) and third party SDKs and libraries (one o them is an SDK for Augmented Reality), so my javascript "bridge" handle all those API calls.

Every single app is made then within WebView environment (here I can use a variety of js libraries and frameworks like AngulerJS, JQuery etc...). My apps look like a transparent html body, camera image behind it with augmented reality 3d scene (3d models and 3d interfaces), other html views used for texts, images, lists, forms, popups, dialogs and so on.

This stack i quite solid and i made a lot of apps with it.

Then I found React-Native and i thought about realizing the "2D" part (that was always made in HTML) using native mobile components. So the question is: is it even possible to use my javascript "bridge" in React-Native context? I mean this "bridge" is attached to the WebView, what if I could transform it somehow to use with React-Native?

No, you can't. React Native does not use WebViews under the hood but normal iOS / Android UI Components.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM