com.facebook.react.modules.appstate.AppStateModule Java Examples

The following examples show how to use com.facebook.react.modules.appstate.AppStateModule. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CatalystNativeJavaToJSReturnValuesTestCase.java    From react-native-GPay with MIT License 6 votes vote down vote up
@Override
protected void setUp() throws Exception {
  super.setUp();

  final UIManagerModule mUIManager =
      new UIManagerModule(
          getContext(), new ArrayList<ViewManager>(), 0);

  mAssertModule = new AssertModule();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mAssertModule)
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addNativeModule(mUIManager)
      .addNativeModule(new TestModule())
      .build();
}
 
Example #2
Source File: ThreadBaseReactPackage.java    From react-native-threads with MIT License 6 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext catalystApplicationContext) {
    return Arrays.<NativeModule>asList(
            // Core list
            new AndroidInfoModule(catalystApplicationContext),
            new ExceptionsManagerModule(reactInstanceManager.getDevSupportManager()),
            new AppStateModule(catalystApplicationContext),
            new TimingModule(catalystApplicationContext, reactInstanceManager.getDevSupportManager()),
            new UIManagerStubModule(catalystApplicationContext),
            new SourceCodeModule(catalystApplicationContext),
            new JSCHeapCapture(catalystApplicationContext),

            // Main list
            new AsyncStorageModule(catalystApplicationContext),
            new IntentModule(catalystApplicationContext),
            new NetworkingModule(catalystApplicationContext),
            new VibrationModule(catalystApplicationContext),
            new WebSocketModule(catalystApplicationContext),
            new ThreadSelfModule(catalystApplicationContext),
            new DevSettingsModule(catalystApplicationContext, reactInstanceManager.getDevSupportManager())
    );
}
 
Example #3
Source File: ProgressBarTestCase.java    From progress-bar-android with MIT License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager(),
      new ReactProgressBarViewManager());
  mUIManager =
      new UIManagerModule(getContext(), viewManagers, 0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mUIManager)
      .addNativeModule(new AndroidInfoModule(getContext()))
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .build();

  mRootView = new ReactRootView(getContext());
  DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
  mRootView.setLayoutParams(
      new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels));
  int rootTag = mUIManager.addRootView(mRootView);
  mInstance.getJSModule(ProgressBarTestModule.class).renderProgressBarApplication(rootTag);
  waitForBridgeAndUIIdle();
}
 
Example #4
Source File: CatalystNativeJSToJavaParametersTestCase.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager());
  final UIManagerModule mUIManager =
      new UIManagerModule(getContext(), viewManagers, 0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mRecordingTestModule = new RecordingTestModule();
  mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mRecordingTestModule)
      .addNativeModule(new AndroidInfoModule(getContext()))
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addNativeModule(mUIManager)
      .build();
}
 
Example #5
Source File: ProgressBarTestCase.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager(),
      new ReactProgressBarViewManager());
  mUIManager =
      new UIManagerModule(getContext(), viewManagers, 0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mUIManager)
      .addNativeModule(new AndroidInfoModule(getContext()))
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .build();

  mRootView = new ReactRootView(getContext());
  DisplayMetrics metrics = getContext().getResources().getDisplayMetrics();
  mRootView.setLayoutParams(
      new FrameLayout.LayoutParams(metrics.widthPixels, metrics.heightPixels));
  int rootTag = mUIManager.addRootView(mRootView);
  mInstance.getJSModule(ProgressBarTestModule.class).renderProgressBarApplication(rootTag);
  waitForBridgeAndUIIdle();
}
 
Example #6
Source File: ViewRenderingTestCase.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(new ReactViewManager());
  final UIManagerModule uiManager =
      new UIManagerModule(getContext(), viewManagers, 0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          uiManager.onHostResume();
        }
      });
  waitForIdleSync();

  mCatalystInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(uiManager)
      .addNativeModule(new AndroidInfoModule(getContext()))
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .build();

  mRootView = new ReactRootView(getContext());
  mRootTag = uiManager.addRootView(mRootView);
}
 
Example #7
Source File: CatalystNativeJavaToJSArgumentsTestCase.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager());
  final UIManagerModule mUIManager =
      new UIManagerModule(getContext(), viewManagers, 0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mAssertModule = new AssertModule();

  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mAssertModule)
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .addNativeModule(mUIManager)
      .build();
}
 
Example #8
Source File: JSLocaleTest.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager());
  final UIManagerModule mUIManager = new UIManagerModule(
      getContext(),
      viewManagers,
      0);
  UiThreadUtil.runOnUiThread(
      new Runnable() {
        @Override
        public void run() {
          ReactChoreographer.initialize();
          mUIManager.onHostResume();
        }
      });
  waitForIdleSync();

  mStringRecordingModule = new StringRecordingModule();
  mInstance = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(mStringRecordingModule)
      .addNativeModule(mUIManager)
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .build();
}
 
Example #9
Source File: CatalystUIManagerTestCase.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
  super.setUp();

  List<ViewManager> viewManagers = Arrays.<ViewManager>asList(
      new ReactViewManager(),
      new ReactTextViewManager(),
      new ReactRawTextManager());
  uiManager =
      new UIManagerModule(getContext(), viewManagers, 0);
  UiThreadUtil.runOnUiThread(new Runnable() {
    @Override
    public void run() {
      uiManager.onHostResume();
    }
  });
  waitForIdleSync();

  jsModule = ReactTestHelper.catalystInstanceBuilder(this)
      .addNativeModule(uiManager)
      .addNativeModule(new AndroidInfoModule(getContext()))
      .addNativeModule(new DeviceInfoModule(getContext()))
      .addNativeModule(new AppStateModule(getContext()))
      .addNativeModule(new FakeWebSocketModule())
      .build()
      .getJSModule(UIManagerTestModule.class);
}