As a newbie, I wrote a alert('hellooooo')
in a React native project and my Expo on phone simulator actually showed me the alert !
I was a bit confused, we’re supposed to see a pure native iOS or Android app with no JS at all… Is Expo faking native through a webView and is in fact purely web ? Or is the alert() JS function actually re-written in actual Objective-C or Java code ?
I was a bit confused, we’re supposed to see a pure native iOS or Android app with no JS at all
I’m not sure where you get those expectations, expo or in general, react-native executes js as there is, there is no magic conversion to objc or java. Native part are the components that react-native/expo and other libraries provide, you are using js code that calls native code. You can create webview inside rn app, but app itself is not rendered using webiview.
Or is the alert() JS function actually re-written in actual Objective-C or Java code ?
I have no idea, it’s either implemented in RN or you might have some dependency that is polyfiling web apis.
Have a look at this blog post that might clarify some things for you:
Ok merci !
Big revelation indeed, I thought all the js was converted in Objective-C or Java… by the way it could but might occurs some bug I guess, at least we would have a really native app.
I also thought that from a native point of view, only a webview can execute JS, but you wrote that it ships with a JS core… desktop and web are not so far away from each other apparently.
My alert() works on Expo but do you think it would with a compiled app uploaded to Play and App stores ?