类com.facebook.react.bridge.ReactApplicationContext源码实例Demo

下面列出了怎么用com.facebook.react.bridge.ReactApplicationContext的API类实例代码及写法,或者点击链接到github查看源代码。

@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());
}
 
源代码2 项目: react-native-GPay   文件: UIManagerModule.java
@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);
}
 
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;
}
 
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();
  modules.add(new ReactNativeOBD2Module(reactContext));

  return modules;
}
 
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();
}
 
public NearbyConnectionModule(ReactApplicationContext reactContext) {
      super(reactContext);
this.reactContext = reactContext;

onResume();

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

  modules.add(new AccountManagerModule(reactContext));

  return modules;
}
 
源代码8 项目: react-native-firestack   文件: FirestackStorage.java
public FirestackStorage(ReactApplicationContext reactContext) {
  super(reactContext);

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

  Log.d(TAG, "New instance");
}
 
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new DynamicSplashModule(reactContext));
    return modules;
}
 
public RNBluetoothManagerModule(ReactApplicationContext reactContext) {
    super(reactContext);
    this.reactContext = reactContext;
    reactContext.addLifecycleEventListener(this);
    btAdapter = BluetoothAdapter.getDefaultAdapter();
    registerBroadcastReceiver();
}
 
源代码11 项目: dingo   文件: ProxiedFetchReactPackage.java
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new ProxiedFetchModule(reactContext));
    return modules;
}
 
源代码12 项目: dingo   文件: SplashScreenReactPackage.java
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new SplashScreenModule(reactContext));
    return modules;
}
 
源代码13 项目: Instabug-React-Native   文件: InstabugUtil.java
public static void sendEvent(ReactApplicationContext reactContext,
                       String eventName,
                       WritableMap params) {
    reactContext
            .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
            .emit(eventName, params);
}
 
源代码14 项目: react-native-lanscan   文件: LANScanReactModule.java
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new LANScanModule(reactContext));

    return modules;
}
 
源代码15 项目: react-native-flurry-sdk   文件: FlurryPackage.java
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new FlurryModule(reactContext));

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

    mReceiver = new SmsReceiver(context);
    getReactApplicationContext().addLifecycleEventListener(this);
    registerReceiverIfNecessary(mReceiver);
}
 
源代码18 项目: react-native-GPay   文件: NativeAnimatedModule.java
@Override
public void initialize() {
  ReactApplicationContext reactCtx = getReactApplicationContext();
  UIManagerModule uiManager = reactCtx.getNativeModule(UIManagerModule.class);
  reactCtx.addLifecycleEventListener(this);
  uiManager.addUIManagerListener(this);
}
 
public RNShineButtonModule(ReactApplicationContext reactContext) {
    super(reactContext);
}
 
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  return Arrays.<NativeModule>asList(new RNMessageComposeModule(reactContext));
}
 
@NonNull
@Override
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
 
源代码22 项目: react-native-share   文件: InstagramStoriesShare.java
public InstagramStoriesShare(ReactApplicationContext reactContext) {
    super(reactContext);
    this.setIntent(new Intent("com.instagram.share.ADD_TO_STORY"));
}
 
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  return Arrays.<NativeModule>asList(new MidtransModule(reactContext));
}
 
源代码24 项目: lottie-react-native   文件: LottiePackage.java
@SuppressWarnings("rawtypes") @Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Collections.<ViewManager>singletonList(new LottieAnimationViewManager());
}
 
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    return Arrays.<NativeModule>asList(new ShareExModule(reactContext));
}
 
public CrosswalkWebViewGroupManager (ReactApplicationContext _reactContext) {
    reactContext = _reactContext;
}
 
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Collections.emptyList();
}
 
源代码28 项目: react-native-keychain   文件: KeychainPackage.java
@Override
@NonNull
public List<NativeModule> createNativeModules(@NonNull final ReactApplicationContext reactContext) {
  return Collections.singletonList(KeychainModule.withWarming(reactContext));
}
 
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  return Collections.emptyList();
}
 
源代码30 项目: react-native-sqlite-storage   文件: SQLitePlugin.java
public SQLitePlugin(ReactApplicationContext reactContext) {
    super(reactContext);
    this.context = reactContext.getApplicationContext();
    this.threadPool = Executors.newCachedThreadPool();
}
 
 同包方法