com.facebook.react.bridge.NativeModule Java Examples

The following examples show how to use com.facebook.react.bridge.NativeModule. 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: DebugCorePackage.java    From react-native-GPay with MIT License 6 votes vote down vote up
@Override
public List<ModuleSpec> getNativeModules(final ReactApplicationContext reactContext) {
  List<ModuleSpec> moduleSpecList = new ArrayList<>();
  moduleSpecList.add(
      ModuleSpec.nativeModuleSpec(
          JSCHeapCapture.class,
          new Provider<NativeModule>() {
            @Override
            public NativeModule get() {
              return new JSCHeapCapture(reactContext);
            }
          }));
  moduleSpecList.add(
      ModuleSpec.nativeModuleSpec(
          JSCSamplingProfiler.class,
          new Provider<NativeModule>() {
            @Override
            public NativeModule get() {
              return new JSCSamplingProfiler(reactContext);
            }
          }));
  return moduleSpecList;
}
 
Example #2
Source File: ReactNativeOBD2Package.java    From react-native-obd2 with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();
  modules.add(new ReactNativeOBD2Module(reactContext));

  return modules;
}
 
Example #3
Source File: SQLitePluginPackage.java    From react-native-sqlite-storage with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
                            ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();
  modules.add(new SQLitePlugin(reactContext));
  return modules;
}
 
Example #4
Source File: CompositeReactPackageTest.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Test
public void testThatCompositeReturnsASumOfNativeModules() {
  // Given
  CompositeReactPackage composite = new CompositeReactPackage(packageNo1, packageNo2);

  NativeModule moduleNo1 = mock(NativeModule.class);
  when(moduleNo1.getName()).thenReturn("ModuleNo1");

  // module2 and module3 will share same name, composite should return only the latter one
  final String sameModuleName = "SameModuleName";

  NativeModule moduleNo2 = mock(NativeModule.class);
  when(moduleNo2.getName()).thenReturn(sameModuleName);

  NativeModule moduleNo3 = mock(NativeModule.class);
  when(moduleNo3.getName()).thenReturn(sameModuleName);

  NativeModule moduleNo4 = mock(NativeModule.class);
  when(moduleNo4.getName()).thenReturn("ModuleNo4");

  when(packageNo1.createNativeModules(reactContext)).thenReturn(
      Arrays.asList(new NativeModule[]{moduleNo1, moduleNo2}));

  when(packageNo2.createNativeModules(reactContext)).thenReturn(
      Arrays.asList(new NativeModule[]{moduleNo3, moduleNo4}));

  // When
  List<NativeModule> compositeModules = composite.createNativeModules(reactContext);

  // Then

  // Wrapping lists into sets to be order-independent.
  // Note that there should be no module2 returned.
  Set<NativeModule> expected = new HashSet<>(
      Arrays.asList(new NativeModule[]{moduleNo1, moduleNo3, moduleNo4}));
  Set<NativeModule> actual = new HashSet<>(compositeModules);

  assertEquals(expected, actual);
}
 
Example #5
Source File: RNCAppearancePackage.java    From react-native-appearance with MIT License 5 votes vote down vote up
@NonNull
@Override
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
    List modules = new ArrayList();
    modules.add(new RNCAppearanceModule(reactContext));
    return modules;
}
 
Example #6
Source File: ArcGISMapPackage.java    From react-native-arcgis-sdk-demo with Apache License 2.0 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    Log.v("ArcGISMapPackage", "createNativeModules");
    List<NativeModule> modules = new ArrayList<>();
    modules.add(arcGISMapModule);
    return modules;
}
 
Example #7
Source File: RNBottomSheetPackage.java    From react-native-bottom-sheet with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new RNBottomSheet(reactContext));

    return modules;
}
 
Example #8
Source File: FlurryAnalyticsPackage.java    From react-native-flurry-analytics with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new FlurryAnalyticsModule(reactContext));

    return modules;
}
 
Example #9
Source File: ClipboardPackage.java    From clipboard with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();

  modules.add(new ClipboardModule(reactContext));

  return modules;
}
 
Example #10
Source File: RNImmediatePhoneCallPackage.java    From react-native-immediate-phone-call with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new RNImmediatePhoneCallModule(reactContext));

    return modules;
}
 
Example #11
Source File: ReactNativeIntlPackage.java    From react-native-intl with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
	List<NativeModule> modules = new ArrayList<>();

	modules.add(new ReactNativeIntl(reactContext));

	return modules;
}
 
Example #12
Source File: RNActivityRecognitionPackage.java    From react-native-activity-recognition with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new RNActivityRecognitionNativeModule(reactContext));

    return modules;
}
 
Example #13
Source File: Web3WebviewPackage.java    From react-native-web3-webview with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modulesList = new ArrayList<>();
    module = new Web3WebviewModule(reactContext);
    modulesList.add(module);
    return modulesList;
}
 
Example #14
Source File: PayPalPackage.java    From react-native-paypal with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();
  paypalModule = new PayPal(reactContext, context, paymentIntentRequestCode);

  modules.add(paypalModule);
  return modules;
}
 
Example #15
Source File: LANScanReactModule.java    From react-native-lanscan with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new LANScanModule(reactContext));

    return modules;
}
 
Example #16
Source File: RNWebViewJSContextPackage.java    From react-native-webview-js-context with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new RNWebViewJSContextModule(reactContext));

    return modules;
}
 
Example #17
Source File: RNBottomSheetPackage.java    From react-native-bottomsheet with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new RNBottomSheet(reactContext));

    return modules;
}
 
Example #18
Source File: ReactNativeSmoochPackage.java    From react-native-smooch with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new ReactNativeSmooch(reactContext));
    return modules;
}
 
Example #19
Source File: CookieManagerPackage.java    From imsdk-android with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new CookieManagerModule(reactContext));
    return modules;
}
 
Example #20
Source File: PjSipModulePackage.java    From react-native-pjsip with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new PjSipModule(reactContext));
    return modules;
}
 
Example #21
Source File: RNSQLiteModule.java    From react-native-android-sqlite with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
                            ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();

  modules.add(new DBManager(reactContext));

  return modules;
}
 
Example #22
Source File: ReactDatePackage.java    From react-native-date with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
                            ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();
  modules.add(new DateModule(reactContext));
  return modules;
}
 
Example #23
Source File: RCTChirpSDKPackage.java    From chirp-react-native with Apache License 2.0 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new RCTChirpSDKModule(reactContext));

    return modules;
}
 
Example #24
Source File: BackgroundColorPackage.java    From react-native-background-color with The Unlicense 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new BackgroundColorModule(reactContext));

    return modules;
}
 
Example #25
Source File: RNDownloadButtonPackage.java    From react-native-download-button with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new RNDownloadButtonModule(reactContext));

    return modules;
}
 
Example #26
Source File: BadgePackage.java    From react-native-android-badge with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
                            ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();

  modules.add(new BadgeModule(reactContext));
  return modules;
}
 
Example #27
Source File: ReactTestHelper.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
public ReactInstanceEasyBuilder addNativeModule(NativeModule nativeModule) {
  if (mNativeModuleRegistryBuilder == null) {
    mNativeModuleRegistryBuilder = new NativeModuleRegistryBuilder(
      (ReactApplicationContext) mContext,
      null);
  }
  Assertions.assertNotNull(nativeModule);
  mNativeModuleRegistryBuilder.addNativeModule(nativeModule);
  return this;
}
 
Example #28
Source File: RNVersionCheckPackage.java    From react-native-version-check with MIT License 4 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  return Arrays.<NativeModule>asList(new RNVersionCheckModule(reactContext));
}
 
Example #29
Source File: FullScreenModule.java    From react-native-full-screen with MIT License 4 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactApplicationContext) {
  return  Arrays.<NativeModule>asList(new FullScreen(reactApplicationContext));
}
 
Example #30
Source File: BackgroundJobPackage.java    From react-native-background-job with MIT License 4 votes vote down vote up
@Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  return Collections.<NativeModule>singletonList(new BackgroundJobModule(reactContext));
}