Skip to content

Commit

Permalink
docs(SETUP.md): correct and extend other JSI libs example
Browse files Browse the repository at this point in the history
  • Loading branch information
david-gettins committed Oct 4, 2021
1 parent 5f9a91b commit 1b68086
Showing 1 changed file with 6 additions and 4 deletions.
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

0 comments on commit 1b68086

Please sign in to comment.