Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Serck96 committed Jan 19, 2024
1 parent bacfae1 commit 3f931e1
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,59 @@ $ yarn add react-native-v8 v8-android-jit
@Override
```

For React Native 0.73 and above, you can use the following code instead:

```diff
--- a/android/app/src/main/java/com/rn073/MainApplication.kt
+++ b/android/app/src/main/java/com/rn073/MainApplication.kt
@@ -1,15 +1,20 @@
package com.rn073;

import android.app.Application
+
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
+import com.facebook.react.bridge.JavaScriptExecutorFactory
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.flipper.ReactNativeFlipper
+import com.facebook.react.modules.systeminfo.AndroidInfoHelpers
import com.facebook.soloader.SoLoader

+import io.csie.kudo.reactnative.v8.executor.V8ExecutorFactory;
+
class MainApplication : Application(), ReactApplication {

override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be auto linked yet can be added manually here, for example:
// add(MyReactNativePackage())
}
override fun getJSMainModuleName(): String = "index"

override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
+
+ override fun getJavaScriptExecutorFactory(): JavaScriptExecutorFactory =
+ V8ExecutorFactory(
+ applicationContext,
+ packageName,
+ AndroidInfoHelpers.getFriendlyDeviceName(),
+ useDeveloperSupport
+ )
};

override val reactHost: ReactHost
```

4. Disable Hermes

```diff
Expand Down

0 comments on commit 3f931e1

Please sign in to comment.