Java Code Examples for com.facebook.react.bridge.ReactApplicationContext

The following examples show how to use com.facebook.react.bridge.ReactApplicationContext. These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: react-native-keychain   Source File: KeychainModuleTests.java    License: MIT License 6 votes vote down vote up
@Test
@Config(sdk = Build.VERSION_CODES.P)
public void testGetSecurityLevel_NoBiometry_api28() throws Exception {
  // GIVE:
  final ReactApplicationContext context = getRNContext();
  final KeychainModule module = new KeychainModule(context);
  final Promise mockPromise = mock(Promise.class);

  // WHEN:
  final JavaOnlyMap options = new JavaOnlyMap();
  options.putString(Maps.ACCESS_CONTROL, AccessControl.DEVICE_PASSCODE);

  module.getSecurityLevel(options, mockPromise);

  // THEN:
  verify(mockPromise).resolve(SecurityLevel.SECURE_HARDWARE.name());
}
 
Example 2
Source Project: react-native-GPay   Source File: UIManagerModule.java    License: MIT License 6 votes vote down vote up
@Deprecated
public UIManagerModule(
    ReactApplicationContext reactContext,
    ViewManagerResolver viewManagerResolver,
    UIImplementationProvider uiImplementationProvider,
    int minTimeLeftInFrameForNonBatchedOperationMs) {
  super(reactContext);
  DisplayMetricsHolder.initDisplayMetricsIfNotInitialized(reactContext);
  mEventDispatcher = new EventDispatcher(reactContext);
  mModuleConstants = createConstants(viewManagerResolver);
  mCustomDirectEvents = UIManagerModuleConstants.getDirectEventTypeConstants();
  mUIImplementation =
      uiImplementationProvider.createUIImplementation(
          reactContext,
          viewManagerResolver,
          mEventDispatcher,
          minTimeLeftInFrameForNonBatchedOperationMs);

  reactContext.addLifecycleEventListener(this);
}
 
Example 3
Source Project: react-native-jw-media-player   Source File: RNJWPlayerView.java    License: MIT License 6 votes vote down vote up
private static Context getNonBuggyContext(ThemedReactContext reactContext,
                                          ReactApplicationContext appContext) {
    Context superContext = reactContext;
    if (!contextHasBug(appContext.getCurrentActivity())) {
        superContext = appContext.getCurrentActivity();
    } else if (contextHasBug(superContext)) {
        // we have the bug! let's try to find a better context to use
        if (!contextHasBug(reactContext.getCurrentActivity())) {
            superContext = reactContext.getCurrentActivity();
        } else if (!contextHasBug(reactContext.getApplicationContext())) {
            superContext = reactContext.getApplicationContext();
        } else {
            // ¯\_(ツ)_/¯
        }
    }
    return superContext;
}
 
Example 4
Source Project: react-native-obd2   Source File: ReactNativeOBD2Package.java    License: 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 5
public ProximityManager(ReactApplicationContext context, EventManager em) {
    eventManager = em;
    powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
    proximitySensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
    initProximityWakeLock();
}
 
Example 6
public NearbyConnectionModule(ReactApplicationContext reactContext) {
      super(reactContext);
this.reactContext = reactContext;

onResume();

setLifecycleListeners();
  }
 
Example 7
@Override
public List<NativeModule> createNativeModules(
ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();

  modules.add(new AccountManagerModule(reactContext));

  return modules;
}
 
Example 8
Source Project: react-native-firestack   Source File: FirestackStorage.java    License: MIT License 5 votes vote down vote up
public FirestackStorage(ReactApplicationContext reactContext) {
  super(reactContext);

  Log.d(TAG, "Attaching FirestackStorage");
  this.context = reactContext;
  mReactContext = reactContext;

  Log.d(TAG, "New instance");
}
 
Example 9
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new DynamicSplashModule(reactContext));
    return modules;
}
 
Example 10
public RNBluetoothManagerModule(ReactApplicationContext reactContext) {
    super(reactContext);
    this.reactContext = reactContext;
    reactContext.addLifecycleEventListener(this);
    btAdapter = BluetoothAdapter.getDefaultAdapter();
    registerBroadcastReceiver();
}
 
Example 11
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new ProxiedFetchModule(reactContext));
    return modules;
}
 
Example 12
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new SplashScreenModule(reactContext));
    return modules;
}
 
Example 13
Source Project: Instabug-React-Native   Source File: InstabugUtil.java    License: MIT License 5 votes vote down vote up
public static void sendEvent(ReactApplicationContext reactContext,
                       String eventName,
                       WritableMap params) {
    reactContext
            .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit(eventName, params);
}
 
Example 14
Source Project: react-native-lanscan   Source File: LANScanReactModule.java    License: 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 15
Source Project: react-native-flurry-sdk   Source File: FlurryPackage.java    License: 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 FlurryModule(reactContext));

    return modules;
}
 
Example 16
public RCTCameraModule(ReactApplicationContext reactContext) {
    super(reactContext);
    _reactContext = reactContext;
    _sensorOrientationChecker = new RCTSensorOrientationChecker(_reactContext);
    _reactContext.addLifecycleEventListener(this);
    sound.load(MediaActionSound.SHUTTER_CLICK);
}
 
Example 17
public SmsListenerModule(ReactApplicationContext context) {
    super(context);

    mReceiver = new SmsReceiver(context);
    getReactApplicationContext().addLifecycleEventListener(this);
    registerReceiverIfNecessary(mReceiver);
}
 
Example 18
Source Project: react-native-GPay   Source File: NativeAnimatedModule.java    License: MIT License 5 votes vote down vote up
@Override
public void initialize() {
  ReactApplicationContext reactCtx = getReactApplicationContext();
  UIManagerModule uiManager = reactCtx.getNativeModule(UIManagerModule.class);
  reactCtx.addLifecycleEventListener(this);
  uiManager.addUIManagerListener(this);
}
 
Example 19
public RNShineButtonModule(ReactApplicationContext reactContext) {
    super(reactContext);
}
 
Example 20
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  return Arrays.<NativeModule>asList(new RNMessageComposeModule(reactContext));
}
 
Example 21
@NonNull
@Override
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example 22
Source Project: react-native-share   Source File: InstagramStoriesShare.java    License: MIT License 4 votes vote down vote up
public InstagramStoriesShare(ReactApplicationContext reactContext) {
    super(reactContext);
    this.setIntent(new Intent("com.instagram.share.ADD_TO_STORY"));
}
 
Example 23
Source Project: react-native-payment-gateway   Source File: MidtransPackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  return Arrays.<NativeModule>asList(new MidtransModule(reactContext));
}
 
Example 24
Source Project: lottie-react-native   Source File: LottiePackage.java    License: Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("rawtypes") @Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Collections.<ViewManager>singletonList(new LottieAnimationViewManager());
}
 
Example 25
Source Project: react-native-share-extension   Source File: ShareExPackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    return Arrays.<NativeModule>asList(new ShareExModule(reactContext));
}
 
Example 26
public CrosswalkWebViewGroupManager (ReactApplicationContext _reactContext) {
    reactContext = _reactContext;
}
 
Example 27
Source Project: react-native-sound-player   Source File: RNSoundPlayerPackage.java    License: MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Collections.emptyList();
}
 
Example 28
Source Project: react-native-keychain   Source File: KeychainPackage.java    License: MIT License 4 votes vote down vote up
@Override
@NonNull
public List<NativeModule> createNativeModules(@NonNull final ReactApplicationContext reactContext) {
  return Collections.singletonList(KeychainModule.withWarming(reactContext));
}
 
Example 29
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  return Collections.emptyList();
}
 
Example 30
Source Project: react-native-sqlite-storage   Source File: SQLitePlugin.java    License: MIT License 4 votes vote down vote up
public SQLitePlugin(ReactApplicationContext reactContext) {
    super(reactContext);
    this.context = reactContext.getApplicationContext();
    this.threadPool = Executors.newCachedThreadPool();
}