當前位置: 首頁>>代碼示例>>Java>>正文


Java ReactApplicationContext類代碼示例

本文整理匯總了Java中com.facebook.react.bridge.ReactApplicationContext的典型用法代碼示例。如果您正苦於以下問題:Java ReactApplicationContext類的具體用法?Java ReactApplicationContext怎麽用?Java ReactApplicationContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ReactApplicationContext類屬於com.facebook.react.bridge包,在下文中一共展示了ReactApplicationContext類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createUIManager

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
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);
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:17,代碼來源:CoreModulesPackage.java

示例2: createNativeModules

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
/**
 * {@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());
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:25,代碼來源:CompositeReactPackage.java

示例3: setUp

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
@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();
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:17,代碼來源:DialogModuleTest.java

示例4: createNativeModules

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
@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;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:22,代碼來源:LazyReactPackage.java

示例5: NetworkingModule

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
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<>();
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:22,代碼來源:NetworkingModule.java

示例6: createNativeModules

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
@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)
    );
}
 
開發者ID:joltup,項目名稱:react-native-threads,代碼行數:24,代碼來源:ThreadBaseReactPackage.java

示例7: createNativeModules

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new RNBottomSheet(reactContext));

    return modules;
}
 
開發者ID:Clip-sub,項目名稱:react-native-bottomsheet,代碼行數:8,代碼來源:RNBottomSheetPackage.java

示例8: createNativeModules

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();

    modules.add(new Module(reactContext));

    return modules;
}
 
開發者ID:manuelkch,項目名稱:react-native-network-connection-class,代碼行數:10,代碼來源:Package.java

示例9: setup

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ConcreteViewManager();
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:9,代碼來源:SimpleViewPropertyTest.java

示例10: setUp

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
@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));
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:11,代碼來源:UIManagerModuleConstantsTest.java

示例11: setupReactContext

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
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);
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:30,代碼來源:ReactInstanceManager.java

示例12: createNativeModules

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
@Override
public List<NativeModule> createNativeModules(
        ReactApplicationContext reactContext) {
    List<NativeModule> modules = new ArrayList<>();
    modules.add(new WearCommunicationModule(reactContext));
    return modules;
}
 
開發者ID:bevkoski,項目名稱:react-native-android-wear-demo,代碼行數:8,代碼來源:WearCommunicationReactPackage.java

示例13: GethHolder

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
protected GethHolder(ReactApplicationContext reactContext) {
    this.reactContext = reactContext;
    try {
        NodeConfig nc = new NodeConfig();
        setNodeConfig(nc);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:YsnKsy,項目名稱:react-native-geth,代碼行數:10,代碼來源:GethHolder.java

示例14: getUIManagerModule

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
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;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:15,代碼來源:TextInputTest.java

示例15: createNativeModules

import com.facebook.react.bridge.ReactApplicationContext; //導入依賴的package包/類
/**
 * @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;
}
 
開發者ID:petersobolev,項目名稱:nfc-react-native-simple,代碼行數:12,代碼來源:NfcReactNativeSimplePackage.java


注:本文中的com.facebook.react.bridge.ReactApplicationContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。