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

项目:RNLearn_Project1    文件:CoreModulesPackage.java   
private UIManagerModule createUIManager(ReactApplicationContext reactContext) {
  ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_START);
  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "createUIManagerModule");
  try {
    List<ViewManager> viewManagersList = mReactInstanceManager.createAllViewManagers(
      reactContext);
    return new UIManagerModule(
      reactContext,
      viewManagersList,
      mUIImplementationProvider,
      mLazyViewManagersEnabled);
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_UI_MANAGER_MODULE_END);
  }
}
项目:RNLearn_Project1    文件:CompositeReactPackage.java   
/**
 * {@inheritDoc}
 */
@Override
public List<NativeModule> createNativeModules(
    ReactApplicationContext reactContext,
    ReactInstanceManager reactInstanceManager) {
  final Map<String, NativeModule> moduleMap = new HashMap<>();
  for (ReactPackage reactPackage: mChildReactPackages) {
    List<NativeModule> nativeModules;
    if (reactPackage instanceof ReactInstancePackage) {
      ReactInstancePackage reactInstancePackage = (ReactInstancePackage) reactPackage;
      nativeModules = reactInstancePackage.createNativeModules(
          reactContext,
          reactInstanceManager);
    } else {
      nativeModules = reactPackage.createNativeModules(reactContext);
    }
    for (NativeModule nativeModule: nativeModules) {
      moduleMap.put(nativeModule.getName(), nativeModule);
    }
  }
  return new ArrayList(moduleMap.values());
}
项目:RNLearn_Project1    文件:DialogModuleTest.java   
@Before
public void setUp() throws Exception {
  mActivityController = Robolectric.buildActivity(Activity.class);
  mActivity = mActivityController
      .create()
      .start()
      .resume()
      .get();

  final ReactApplicationContext context = PowerMockito.mock(ReactApplicationContext.class);
  PowerMockito.when(context.hasActiveCatalystInstance()).thenReturn(true);
  PowerMockito.when(context, "getCurrentActivity").thenReturn(mActivity);

  mDialogModule = new DialogModule(context);
  mDialogModule.onHostResume();
}
项目:RNLearn_Project1    文件:LazyReactPackage.java   
@Override
public final List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();
  for (ModuleSpec holder : getNativeModules(reactContext)) {
    NativeModule nativeModule;
    SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createNativeModule")
      .arg("module", holder.getType())
      .flush();
    try {
      ReactMarker.logMarker(
        ReactMarkerConstants.CREATE_MODULE_START,
        holder.getType().getSimpleName());
      nativeModule = holder.getProvider().get();
      ReactMarker.logMarker(ReactMarkerConstants.CREATE_MODULE_END);
    } finally {
      Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    }
    modules.add(nativeModule);
  }
  return modules;
}
项目:RNLearn_Project1    文件:NetworkingModule.java   
NetworkingModule(
    ReactApplicationContext reactContext,
    @Nullable String defaultUserAgent,
    OkHttpClient client,
    @Nullable List<NetworkInterceptorCreator> networkInterceptorCreators) {
  super(reactContext);

  if (networkInterceptorCreators != null) {
    OkHttpClient.Builder clientBuilder = client.newBuilder();
    for (NetworkInterceptorCreator networkInterceptorCreator : networkInterceptorCreators) {
      clientBuilder.addNetworkInterceptor(networkInterceptorCreator.create());
    }
    client = clientBuilder.build();
  }
  mClient = client;
  mCookieHandler = new ForwardingCookieHandler(reactContext);
  mCookieJarContainer = (CookieJarContainer) mClient.cookieJar();
  mShuttingDown = false;
  mDefaultUserAgent = defaultUserAgent;
  mRequestIds = new HashSet<>();
}
项目:react-native-threads    文件:ThreadBaseReactPackage.java   
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext catalystApplicationContext) {
    return Arrays.<NativeModule>asList(
            // Core list
            new AndroidInfoModule(),
            new ExceptionsManagerModule(reactInstanceManager.getDevSupportManager()),
            new AppStateModule(catalystApplicationContext),
            new Timing(catalystApplicationContext, reactInstanceManager.getDevSupportManager()),
            new UIManagerStubModule(catalystApplicationContext),
            new SourceCodeModule(catalystApplicationContext),
            new JSCHeapCapture(catalystApplicationContext),

            // Main list
            new AsyncStorageModule(catalystApplicationContext),
            new IntentModule(catalystApplicationContext),
            new LocationModule(catalystApplicationContext),
            new NetworkingModule(catalystApplicationContext),
            new NetInfoModule(catalystApplicationContext),
            new VibrationModule(catalystApplicationContext),
            new WebSocketModule(catalystApplicationContext),
            new ThreadSelfModule(catalystApplicationContext)
    );
}
项目:RNLearn_Project1    文件:LazyReactPackage.java   
@Override
public final List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();
  for (ModuleSpec holder : getNativeModules(reactContext)) {
    NativeModule nativeModule;
    SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createNativeModule")
      .arg("module", holder.getType())
      .flush();
    try {
      ReactMarker.logMarker(
        ReactMarkerConstants.CREATE_MODULE_START,
        holder.getType().getSimpleName());
      nativeModule = holder.getProvider().get();
      ReactMarker.logMarker(ReactMarkerConstants.CREATE_MODULE_END);
    } finally {
      Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    }
    modules.add(nativeModule);
  }
  return modules;
}
项目:react-native-bottomsheet    文件:RNBottomSheetPackage.java   
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new RNBottomSheet(reactContext));

    return modules;
}
项目:react-native-network-connection-class    文件:Package.java   
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new Module(reactContext));

    return modules;
}
项目:RNLearn_Project1    文件:SimpleViewPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ConcreteViewManager();
}
项目:RNLearn_Project1    文件:UIManagerModuleConstantsTest.java   
@Before
public void setUp() {
  mReactContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mUIImplementationProvider = mock(UIImplementationProvider.class);
  when(mUIImplementationProvider.createUIImplementation(
    any(ReactApplicationContext.class),
    any(List.class),
    any(EventDispatcher.class)))
    .thenReturn(mock(UIImplementation.class));
}
项目:RNLearn_Project1    文件:ReactInstanceManager.java   
private void setupReactContext(ReactApplicationContext reactContext) {
  ReactMarker.logMarker(PRE_SETUP_REACT_CONTEXT_END);
  ReactMarker.logMarker(SETUP_REACT_CONTEXT_START);
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "setupReactContext");
  UiThreadUtil.assertOnUiThread();
  Assertions.assertCondition(mCurrentReactContext == null);
  mCurrentReactContext = Assertions.assertNotNull(reactContext);
  CatalystInstance catalystInstance =
      Assertions.assertNotNull(reactContext.getCatalystInstance());

  catalystInstance.initialize();
  mDevSupportManager.onNewReactContextCreated(reactContext);
  mMemoryPressureRouter.addMemoryPressureListener(catalystInstance);
  moveReactContextToCurrentLifecycleState();

  for (ReactRootView rootView : mAttachedRootViews) {
    attachMeasuredRootViewToInstance(rootView, catalystInstance);
  }

  ReactInstanceEventListener[] listeners =
    new ReactInstanceEventListener[mReactInstanceEventListeners.size()];
  listeners = mReactInstanceEventListeners.toArray(listeners);

  for (ReactInstanceEventListener listener : listeners) {
    listener.onReactContextInitialized(reactContext);
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
  ReactMarker.logMarker(SETUP_REACT_CONTEXT_END);
}
项目:react-native-android-wear-demo    文件:WearCommunicationReactPackage.java   
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new WearCommunicationModule(reactContext));
    return modules;
}
项目:react-native-geth    文件:GethHolder.java   
protected GethHolder(ReactApplicationContext reactContext) {
    this.reactContext = reactContext;
    try {
        NodeConfig nc = new NodeConfig();
        setNodeConfig(nc);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:RNLearn_Project1    文件:TextInputTest.java   
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementationProvider(),
      false);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
项目:RNLearn_Project1    文件:SimpleViewPropertyTest.java   
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ConcreteViewManager();
}
项目:nfc-react-native-simple    文件:NfcReactNativeSimplePackage.java   
/**
 * @param reactContext react application context that can be used to create modules
 * @return list of native modules to register with the newly created catalyst instance
 */
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new NfcReactNativeSimpleModule(reactContext));

    return modules;
}
项目:react-native-cafe-bazaar    文件:CafeBazaarPackage.java   
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new CafeBazaar(reactContext));

    return modules;
}
项目:react-native-collapsing-toolbar    文件:RNCollapsingToolbarPackage.java   
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) {
    return Arrays.<ViewManager>asList(
            new AppBarLayoutManager(),
            new CoordinatorLayoutManager(),
            new CollapsingToolbarLayoutManager(),
            new CollapsingParallaxManager()
    );
}
项目:RNLearn_Project1    文件:UIImplementation.java   
private UIImplementation(
  ReactApplicationContext reactContext,
  ViewManagerRegistry viewManagers,
  EventDispatcher eventDispatcher) {
  this(
      reactContext,
      viewManagers,
      new UIViewOperationQueue(reactContext, new NativeViewHierarchyManager(viewManagers)),
      eventDispatcher);
}
项目:RNLearn_Project1    文件:NativeModuleRegistryBuilder.java   
public NativeModuleRegistryBuilder(
  ReactApplicationContext reactApplicationContext,
  ReactInstanceManager reactInstanceManager,
  boolean lazyNativeModulesEnabled) {
  mReactApplicationContext = reactApplicationContext;
  mReactInstanceManager = reactInstanceManager;
  mLazyNativeModulesEnabled = lazyNativeModulesEnabled;
}
项目:react-native-simple-download-manager    文件:ReactNativeDownloadManagerModule.java   
public ReactNativeDownloadManagerModule(ReactApplicationContext reactContext) {
    super(reactContext);
    downloader = new Downloader(reactContext);
    appDownloads = new LongSparseArray<>();
    IntentFilter filter = new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE);
    reactContext.registerReceiver(downloadReceiver, filter);
}
项目:react-native-threads    文件:RNThreadModule.java   
public RNThreadModule(final ReactApplicationContext reactContext, ReactNativeHost reactNativehost, ReactPackage additionalThreadPackages[]) {
  super(reactContext);
  this.reactApplicationContext = reactContext;
  threads = new HashMap<>();
  this.reactNativeHost = reactNativehost;
  this.additionalThreadPackages = additionalThreadPackages;
  reactContext.addLifecycleEventListener(this);
}
项目:RNLearn_Project1    文件:ReactTestHelper.java   
@Override
public ReactInstanceEasyBuilder addNativeModule(NativeModule nativeModule) {
  if (mNativeModuleRegistryBuilder == null) {
    mNativeModuleRegistryBuilder = new NativeModuleRegistryBuilder(
      (ReactApplicationContext) mContext,
      null,
      false);
  }
  mNativeModuleRegistryBuilder.addNativeModule(nativeModule);
  return this;
}
项目:RNLearn_Project1    文件:ReactSliderPropertyTest.java   
@Before
public void setup() {
  ReactApplicationContext mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  CatalystInstance mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ReactSliderManager();
}
项目:react-native-location-switch    文件:LocationSwitchPackage.java   
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new Module(reactContext));

    return modules;
}
项目:react-native-android-library-humaniq-api    文件:BlockchainModule.java   
public BlockchainModule(ReactApplicationContext reactContext) {
  super(reactContext);
  new Prefs(reactContext);
  ServiceBuilder.init(Constants.BASE_URL, reactContext);

  mixpanel = MixpanelAPI.getInstance(reactContext, Constants.MIXPANEL_TOKEN);
  mixpanel.identify(Prefs.getAccountId());
  mixpanel.getPeople().identify(mixpanel.getDistinctId());
}
项目:RNLearn_Project1    文件:FlatUIImplementation.java   
public static FlatUIImplementation createInstance(
    ReactApplicationContext reactContext,
    List<ViewManager> viewManagers,
    EventDispatcher eventDispatcher,
    boolean memoryImprovementEnabled) {

  RCTImageViewManager rctImageViewManager = findRCTImageManager(viewManagers);
  if (rctImageViewManager != null) {
    Object callerContext = rctImageViewManager.getCallerContext();
    if (callerContext != null) {
      RCTImageView.setCallerContext(callerContext);
    }
  }
  DraweeRequestHelper.setResources(reactContext.getResources());

  TypefaceCache.setAssetManager(reactContext.getAssets());

  ViewManagerRegistry viewManagerRegistry = new ViewManagerRegistry(viewManagers);
  FlatNativeViewHierarchyManager nativeViewHierarchyManager = new FlatNativeViewHierarchyManager(
      viewManagerRegistry);
  FlatUIViewOperationQueue operationsQueue = new FlatUIViewOperationQueue(
      reactContext,
      nativeViewHierarchyManager);
  return new FlatUIImplementation(
    reactContext,
    rctImageViewManager,
    viewManagerRegistry,
    operationsQueue,
    eventDispatcher,
    memoryImprovementEnabled
  );
}
项目:react-native-key-value-storage    文件:KeyValueStoragePackage.java   
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new KeyValueStorageModule(reactContext));

    return modules;
}
项目:RNLearn_Project1    文件:FlatUIImplementation.java   
private FlatUIImplementation(
    ReactApplicationContext reactContext,
    @Nullable RCTImageViewManager rctImageViewManager,
    ViewManagerRegistry viewManagers,
    FlatUIViewOperationQueue operationsQueue,
    EventDispatcher eventDispatcher,
    boolean memoryImprovementEnabled) {
  super(reactContext, viewManagers, operationsQueue, eventDispatcher);
  mReactContext = reactContext;
  mRCTImageViewManager = rctImageViewManager;
  mStateBuilder = new StateBuilder(operationsQueue);
  mMemoryImprovementEnabled = memoryImprovementEnabled;
}
项目:react-native-recyclerview-list    文件:RNRecyclerviewListPackage.java   
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Arrays.<ViewManager>asList(
            new RecyclerViewBackedScrollViewManager(),
            new RecyclerViewItemViewManager()
    );
}
项目:react-native-alert    文件:PLPAlertPackage.java   
@Override
public List<NativeModule> createNativeModules(
                            ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();

  modules.add(new DialogModule(reactContext));

  return modules;
}
项目:RNLearn_Project1    文件:JSCHeapCapture.java   
public JSCHeapCapture(ReactApplicationContext reactContext) {
  super(reactContext);
  mCaptureInProgress = null;
}
项目:react-native-secure-key-store    文件:RNSecureKeyStoreModule.java   
public RNSecureKeyStoreModule(ReactApplicationContext reactContext) {
  super(reactContext);
  this.reactContext = reactContext;
}
项目:react-native-easybluetooth-classic    文件:ClassicPackage.java   
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
项目:react-native-immediate-phone-call    文件:RNImmediatePhoneCallPackage.java   
@Override
public List<ViewManager> createViewManagers(
        ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
项目:react-native-udesk    文件:UdeskPackage.java   
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
项目:react-native-image-intent    文件:ImageIntentPackage.java   
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
    return Collections.emptyList();
}
项目:RNLearn_Project1    文件:ReactPackage.java   
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
  return Collections.emptyList();
}
项目:react-native-connectivity-status    文件:RNConnectivityStatusPackage.java   
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  return Arrays.<NativeModule>asList(new RNConnectivityStatusModule(reactContext));
}