Allow Flipper module instances to be created by applications (#786)
Summary: This allows using the flipper RN module with TurboModules instead of using FlipperPackage. ## Changelog [react-native-flipper] Allow Flipper module instances to be created by applications Pull Request resolved: https://github.com/facebook/flipper/pull/786 Test Plan: An instance of the Flipper module can now be created like this when using TurboModules: ```java Override public NativeModule getModule(String name, ReactApplicationContext reactContext) { switch (name) { ... case FlipperModule.NAME: return new FlipperModule(FlipperReactNativeJavaScriptPluginManager.getInstance(), reactContext); ... } } ``` Tested that it builds Reviewed By: mweststrate Differential Revision: D19812912 Pulled By: passy fbshipit-source-id: 401b3e4552ea0cdb7444a2cf5d170c408edab4db
This commit is contained in:
committed by
Facebook Github Bot
parent
63c8a3a417
commit
912bfed0f8
@@ -30,7 +30,7 @@ public class FlipperModule extends ReactContextBaseJavaModule {
|
||||
|
||||
private final FlipperReactNativeJavaScriptPluginManager mManager;
|
||||
|
||||
FlipperModule(
|
||||
public FlipperModule(
|
||||
FlipperReactNativeJavaScriptPluginManager manager, ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
mManager = manager;
|
||||
|
||||
@@ -30,10 +30,10 @@ import org.json.JSONTokener;
|
||||
* <p>Note that this manager is not bound to a specific FlipperModule instance, as that might be
|
||||
* swapped in and out over time.
|
||||
*/
|
||||
final class FlipperReactNativeJavaScriptPluginManager {
|
||||
public final class FlipperReactNativeJavaScriptPluginManager {
|
||||
private static FlipperReactNativeJavaScriptPluginManager sInstance;
|
||||
|
||||
static synchronized FlipperReactNativeJavaScriptPluginManager getInstance() {
|
||||
public static synchronized FlipperReactNativeJavaScriptPluginManager getInstance() {
|
||||
if (sInstance == null) {
|
||||
sInstance = new FlipperReactNativeJavaScriptPluginManager();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user