As I was reading few blogs on how react native works under the hood, I found out that ios devices have built in javascript engine called javascript core which is used in safari browser. But android phone doesn’t have built in javascript engine so react native has to ship javascript engine as well to android phone along with the bundle.
But my question is android phones also have chrome browser built in. Doesn’t it have V8 engine already? So, why to ship another javascript engine?
If anyone could help me understand this I would be really grateful.
2
Answers
There technically is a built-in V8 engine, but it’s only exposed via the WebView component. But anything that goes beyond what a WebView can do ships with its own JavaScript engine (Even Chrome, as mentioned in the link above), including React Native apps.
And if a native and more accessible V8 engine was added to the OS now, React Native would still need to ship with its own for a while for older devices.
The integration and licensing aspects might be more straightforward on iOS. JavaScriptCore is licensed under LGPL, and its integration within iOS aligns with Apple’s policies and development practices. Integrating V8 into Android as a system-wide library involves more complex legal and technical challenges.