com.facebook.react.bridge.ReactApplicationContext Java Examples

The following examples show how to use com.facebook.react.bridge.ReactApplicationContext. 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: RNJWPlayerView.java    From react-native-jw-media-player with 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 #2
Source File: KeychainModuleTests.java    From react-native-keychain with 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 #3
Source File: UIManagerModule.java    From react-native-GPay with 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 #4
Source File: NearbyConnectionModule.java    From react-native-google-nearby-connection with MIT License 5 votes vote down vote up
public NearbyConnectionModule(ReactApplicationContext reactContext) {
      super(reactContext);
this.reactContext = reactContext;

onResume();

setLifecycleListeners();
  }
 
Example #5
Source File: ProximityManager.java    From react-native-twilio-programmable-voice with MIT License 5 votes vote down vote up
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
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 #7
Source File: AccountManagerPackage.java    From react-native-account-manager with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();

  modules.add(new AccountManagerModule(reactContext));

  return modules;
}
 
Example #8
Source File: FirestackStorage.java    From react-native-firestack with 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
Source File: DynamicSplashReactPackage.java    From react-native-dynamic-splash with MIT License 5 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new DynamicSplashModule(reactContext));
    return modules;
}
 
Example #10
Source File: RNBluetoothManagerModule.java    From react-native-bluetooth-status with MIT License 5 votes vote down vote up
public RNBluetoothManagerModule(ReactApplicationContext reactContext) {
    super(reactContext);
    this.reactContext = reactContext;
    reactContext.addLifecycleEventListener(this);
    btAdapter = BluetoothAdapter.getDefaultAdapter();
    registerBroadcastReceiver();
}
 
Example #11
Source File: SplashScreenReactPackage.java    From dingo 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 SplashScreenModule(reactContext));
    return modules;
}
 
Example #12
Source File: InstabugUtil.java    From Instabug-React-Native with 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 #13
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 #14
Source File: FlurryPackage.java    From react-native-flurry-sdk 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 FlurryModule(reactContext));

    return modules;
}
 
Example #15
Source File: RCTCameraModule.java    From react-native-camera-face-detector with MIT License 5 votes vote down vote up
public RCTCameraModule(ReactApplicationContext reactContext) {
    super(reactContext);
    _reactContext = reactContext;
    _sensorOrientationChecker = new RCTSensorOrientationChecker(_reactContext);
    _reactContext.addLifecycleEventListener(this);
    sound.load(MediaActionSound.SHUTTER_CLICK);
}
 
Example #16
Source File: SmsListenerModule.java    From react-native-android-sms-listener with MIT License 5 votes vote down vote up
public SmsListenerModule(ReactApplicationContext context) {
    super(context);

    mReceiver = new SmsReceiver(context);
    getReactApplicationContext().addLifecycleEventListener(this);
    registerReceiverIfNecessary(mReceiver);
}
 
Example #17
Source File: NativeAnimatedModule.java    From react-native-GPay with 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 #18
Source File: ProxiedFetchReactPackage.java    From dingo 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 ProxiedFetchModule(reactContext));
    return modules;
}
 
Example #19
Source File: ReactNativeInvokeAppPackage.java    From react-native-invoke-app with MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example #20
Source File: WorkerSelfModule.java    From react-native-workers with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void initialize(int workerId, ReactApplicationContext parentContext) {
    this.parentContext = parentContext;
    this.workerId = workerId;
}
 
Example #21
Source File: ReactNativeAPKPackage.java    From react-native-apk with MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Collections.emptyList();
}
 
Example #22
Source File: AndroidYouTubePlayerPackage.java    From dingo with GNU General Public License v3.0 4 votes vote down vote up
@Nonnull
@Override
public List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example #23
Source File: HeartbeatPackage.java    From rn-heartbeat with MIT License 4 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    return Arrays.<NativeModule>asList(
            new HeartbeatModule(reactContext)
    );
}
 
Example #24
Source File: LottiePackage.java    From lottie-react-native with 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 File: MidtransPackage.java    From react-native-payment-gateway with MIT License 4 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  return Arrays.<NativeModule>asList(new MidtransModule(reactContext));
}
 
Example #26
Source File: VLCPlayerPackage.java    From react-native-vlc-player with MIT License 4 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
Example #27
Source File: ArcGISMapModule.java    From react-native-arcgis-sdk-demo with Apache License 2.0 4 votes vote down vote up
public ArcGISMapModule(ReactApplicationContext reactContext) {
    super(reactContext);
}
 
Example #28
Source File: RNBraintreeDropInPackage.java    From react-native-braintree-payments-drop-in with MIT License 4 votes vote down vote up
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Collections.emptyList();
}
 
Example #29
Source File: LockReactModule.java    From react-native-lock with MIT License 4 votes vote down vote up
LockReactModule(ReactApplicationContext reactApplicationContext, LocalBroadcastManager localBroadcastManager, Map<Strategies, IdentityProvider> providers) {
    super(reactApplicationContext);
    this.broadcastManager = localBroadcastManager;
    this.providers = providers;
}
 
Example #30
Source File: ShareExPackage.java    From react-native-share-extension with MIT License 4 votes vote down vote up
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    return Arrays.<NativeModule>asList(new ShareExModule(reactContext));
}