Java Code Examples for com.facebook.react.bridge.CatalystInstance.runJSBundle()

The following are Jave code examples for showing how to use runJSBundle() of the com.facebook.react.bridge.CatalystInstance class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ReactNativeSignatureExample   File: ReactTestHelper.java   Source Code and License Vote up 5 votes
public static ReactTestFactory.ReactInstanceEasyBuilder catalystInstanceBuilder(
    final ReactIntegrationTestCase testCase) {
  final ReactTestFactory.ReactInstanceEasyBuilder builder =
    getReactTestFactory().getCatalystInstanceBuilder();
  ReactTestFactory.ReactInstanceEasyBuilder postBuilder =
    new ReactTestFactory.ReactInstanceEasyBuilder() {
      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder setContext(Context context) {
        builder.setContext(context);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addNativeModule(NativeModule module) {
        builder.addNativeModule(module);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addJSModule(Class moduleInterfaceClass) {
        builder.addJSModule(moduleInterfaceClass);
        return this;
      }

      @Override
      public CatalystInstance build() {
        CatalystInstance instance = builder.build();
        testCase.initializeWithInstance(instance);
        instance.runJSBundle();
        testCase.waitForBridgeAndUIIdle();
        return instance;
      }
    };

  postBuilder.setContext(testCase.getContext());
  return postBuilder;
}
 
Example 2
Project: react-native-ibeacon-android   File: ReactTestHelper.java   Source Code and License Vote up 5 votes
public static ReactTestFactory.ReactInstanceEasyBuilder catalystInstanceBuilder(
    final ReactIntegrationTestCase testCase) {
  final ReactTestFactory.ReactInstanceEasyBuilder builder =
    getReactTestFactory().getCatalystInstanceBuilder();
  ReactTestFactory.ReactInstanceEasyBuilder postBuilder =
    new ReactTestFactory.ReactInstanceEasyBuilder() {
      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder setContext(Context context) {
        builder.setContext(context);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addNativeModule(NativeModule module) {
        builder.addNativeModule(module);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addJSModule(Class moduleInterfaceClass) {
        builder.addJSModule(moduleInterfaceClass);
        return this;
      }

      @Override
      public CatalystInstance build() {
        CatalystInstance instance = builder.build();
        testCase.initializeWithInstance(instance);
        instance.runJSBundle();
        testCase.waitForBridgeAndUIIdle();
        return instance;
      }
    };

  postBuilder.setContext(testCase.getContext());
  return postBuilder;
}
 
Example 3
Project: react-native-box-loaders   File: ReactTestHelper.java   Source Code and License Vote up 5 votes
public static ReactTestFactory.ReactInstanceEasyBuilder catalystInstanceBuilder(
    final ReactIntegrationTestCase testCase) {
  final ReactTestFactory.ReactInstanceEasyBuilder builder =
    getReactTestFactory().getCatalystInstanceBuilder();
  ReactTestFactory.ReactInstanceEasyBuilder postBuilder =
    new ReactTestFactory.ReactInstanceEasyBuilder() {
      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder setContext(Context context) {
        builder.setContext(context);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addNativeModule(NativeModule module) {
        builder.addNativeModule(module);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addJSModule(Class moduleInterfaceClass) {
        builder.addJSModule(moduleInterfaceClass);
        return this;
      }

      @Override
      public CatalystInstance build() {
        CatalystInstance instance = builder.build();
        testCase.initializeWithInstance(instance);
        instance.runJSBundle();
        testCase.waitForBridgeAndUIIdle();
        return instance;
      }
    };

  postBuilder.setContext(testCase.getContext());
  return postBuilder;
}
 
Example 4
Project: RNLearn_Project1   File: ReactTestHelper.java   Source Code and License Vote up 4 votes
public static ReactTestFactory.ReactInstanceEasyBuilder catalystInstanceBuilder(
    final ReactIntegrationTestCase testCase) {
  final ReactTestFactory.ReactInstanceEasyBuilder builder =
    getReactTestFactory().getCatalystInstanceBuilder();
  ReactTestFactory.ReactInstanceEasyBuilder postBuilder =
    new ReactTestFactory.ReactInstanceEasyBuilder() {
      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder setContext(Context context) {
        builder.setContext(context);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addNativeModule(NativeModule module) {
        builder.addNativeModule(module);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addJSModule(Class moduleInterfaceClass) {
        builder.addJSModule(moduleInterfaceClass);
        return this;
      }

      @Override
      public CatalystInstance build() {
        final CatalystInstance instance = builder.build();
        testCase.initializeWithInstance(instance);
        instance.runJSBundle();
        InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
          @Override
          public void run() {
            instance.initialize();
          }
        });
        testCase.waitForBridgeAndUIIdle();
        return instance;
      }
    };

  postBuilder.setContext(testCase.getContext());
  return postBuilder;
}
 
Example 5
Project: RNLearn_Project1   File: ReactTestHelper.java   Source Code and License Vote up 4 votes
public static ReactTestFactory.ReactInstanceEasyBuilder catalystInstanceBuilder(
    final ReactIntegrationTestCase testCase) {
  final ReactTestFactory.ReactInstanceEasyBuilder builder =
    getReactTestFactory().getCatalystInstanceBuilder();
  ReactTestFactory.ReactInstanceEasyBuilder postBuilder =
    new ReactTestFactory.ReactInstanceEasyBuilder() {
      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder setContext(Context context) {
        builder.setContext(context);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addNativeModule(NativeModule module) {
        builder.addNativeModule(module);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addJSModule(Class moduleInterfaceClass) {
        builder.addJSModule(moduleInterfaceClass);
        return this;
      }

      @Override
      public CatalystInstance build() {
        final CatalystInstance instance = builder.build();
        testCase.initializeWithInstance(instance);
        instance.runJSBundle();
        InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
          @Override
          public void run() {
            instance.initialize();
          }
        });
        testCase.waitForBridgeAndUIIdle();
        return instance;
      }
    };

  postBuilder.setContext(testCase.getContext());
  return postBuilder;
}
 
Example 6
Project: Ironman   File: ReactTestHelper.java   Source Code and License Vote up 4 votes
public static ReactTestFactory.ReactInstanceEasyBuilder catalystInstanceBuilder(
    final ReactIntegrationTestCase testCase) {
  final ReactTestFactory.ReactInstanceEasyBuilder builder =
    getReactTestFactory().getCatalystInstanceBuilder();
  ReactTestFactory.ReactInstanceEasyBuilder postBuilder =
    new ReactTestFactory.ReactInstanceEasyBuilder() {
      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder setContext(Context context) {
        builder.setContext(context);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addNativeModule(NativeModule module) {
        builder.addNativeModule(module);
        return this;
      }

      @Override
      public ReactTestFactory.ReactInstanceEasyBuilder addJSModule(Class moduleInterfaceClass) {
        builder.addJSModule(moduleInterfaceClass);
        return this;
      }

      @Override
      public CatalystInstance build() {
        final CatalystInstance instance = builder.build();
        testCase.initializeWithInstance(instance);
        instance.runJSBundle();
        InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
          @Override
          public void run() {
            instance.initialize();
          }
        });
        testCase.waitForBridgeAndUIIdle();
        return instance;
      }
    };

  postBuilder.setContext(testCase.getContext());
  return postBuilder;
}