Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(SETUP.md): correct other JSI libs example #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Since pure JSI Modules cannot be autolinked yet, you have to manually initialize

1. Open your app's `MainApplication.java`
2. Add the following code:

```diff
package com.example.reactnativemultithreading;

Expand Down Expand Up @@ -72,8 +73,6 @@ Since pure JSI Modules cannot be autolinked yet, you have to manually initialize

</details>



<details>
<summary>
<b>With react-native-mmkv (or other JSI libs)</b>
Expand All @@ -92,13 +91,14 @@ Since pure JSI Modules cannot be autolinked yet, you have to manually initialize
import com.facebook.react.bridge.JSIModuleSpec;
import com.facebook.react.bridge.JavaScriptContextHolder;
import com.facebook.react.bridge.ReactApplicationContext;

import com.swmansion.reanimated.ReanimatedJSIModulePackage;
import com.reactnativemmkv.MultithreadingModule;
import com.reactnativemultithreading.MultithreadingModule;

import java.util.Collections;
import java.util.List;

// TODO: Remove all of this when JSI Modules can be autoinstalled (maybe RN 0.65)
// TODO: Remove all of this when JSI Modules can be auto-installed
public class ExampleJSIPackage extends ReanimatedJSIModulePackage {
@Override
public List<JSIModuleSpec> getJSIModules(ReactApplicationContext reactApplicationContext, JavaScriptContextHolder jsContext) {
Expand All @@ -108,9 +108,11 @@ Since pure JSI Modules cannot be autolinked yet, you have to manually initialize
}
}
```

6. Replace `com.example` (first line) with the correct package name
7. Replace `ExampleJSIPackage` with the file name you chose in step 4.
8. Open `MainApplication.java` and find the location where the `ReactNativeHost` is initialized. You have to override it's `getJSIModulePackage` method:

```diff
package com.example.reactnativemultithreading;

Expand Down