Use V8 instead of JavascriptCore for react-native
Asked Answered
P

3

6

It's possible to use by default V8 instead of JavascriptCore when the app is not in debug mode?

I found some issues in JavascriptCore and not in V8 and is annoying switching 😓

Thanks.

Plexor answered 24/6, 2017 at 10:16 Comment(0)
P
2

You could do it by implementing the JSCExecutor using V8 API.

Also, you may consider Chakra as an option. https://github.com/Microsoft/react-native-windows has it integrated.

Promulgate answered 26/7, 2017 at 17:44 Comment(0)
E
1

Have a look at J2V8 provided by EclipseSource. It provides various builds for unix, mac, windows and android and also comes bundled with NodeJS support.

I haven't seen it working with React Native yet, but it is used in the commercial TabrisJS, which provides similar cross-device support to RN.

J2V8 is open-source, and it should be possible to integrate the Java code such that it works with React Native. When RN project was started it was supposed to be able to run on any js engine (don't know if that is still true).

One of their blogs Shipping J2V8 as an AAR (Nov 2015) states using is as simple as adding to build.gradle:

dependencies {
    compile 'com.eclipsesource.j2v8:j2v8:3.1.0-SNAPSHOT@aar'
}

I've found a these github repo's using J2V8 (including one using nodejs).

Ease answered 31/7, 2017 at 13:48 Comment(1)
I just asked an additional question on some viable approaches I found, including J2V8 and react-native-node: Compiling NodeJS as native library on AndroidEase
T
0

I haven't used this yet, but it looks like an awesome project which enables you to use V8 in react-native: Kudo/react-native-v8

Trend answered 18/12, 2019 at 7:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.