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


Java ReactApplication類代碼示例

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


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

示例1: initialize

import com.facebook.react.ReactApplication; //導入依賴的package包/類
@ReactMethod
public void initialize() {
  ReactApplication application = (ReactApplication)getReactApplicationContext()
    .getCurrentActivity()
    .getApplication();

  DevSupportManager devSupportManager = application
    .getReactNativeHost()
    .getReactInstanceManager()
    .getDevSupportManager();

  devSupportManager.addCustomDevOption("Log AsyncStorage", new DevOptionHandler() {
      @Override
      public void onOptionSelected() {
        getReactApplicationContext()
          .getJSModule(RCTNativeAppEventEmitter.class)
          .emit("LogAsyncStorage", null);
      }
  });
}
 
開發者ID:jsoendermann,項目名稱:react-native-async-storage-dev-menu-item,代碼行數:21,代碼來源:AsyncStorageDevMenuItemModule.java

示例2: resolveInstanceManager

import com.facebook.react.ReactApplication; //導入依賴的package包/類
private ReactInstanceManager resolveInstanceManager() throws NoSuchFieldException, IllegalAccessException {
    ReactInstanceManager instanceManager = getReactInstanceManager();
    if (instanceManager != null) {
        return instanceManager;
    }

    final Activity currentActivity = getCurrentActivity();
    if (currentActivity == null) {
        return null;
    }

    ReactApplication reactApplication = (ReactApplication) currentActivity.getApplication();
    instanceManager = reactApplication.getReactNativeHost().getReactInstanceManager();

    return instanceManager;
}
 
開發者ID:avishayil,項目名稱:react-native-restart,代碼行數:17,代碼來源:ReactNativeRestart.java

示例3: DevSettingsModule

import com.facebook.react.ReactApplication; //導入依賴的package包/類
public DevSettingsModule(ReactApplicationContext context) {
    super(context);

    reactContext = context;
    rnHost = ((ReactApplication) context.getApplicationContext())
      .getReactNativeHost();
    instanceManager = rnHost.getReactInstanceManager();
    useDeveloperSupport = rnHost.getUseDeveloperSupport();
    if (useDeveloperSupport) {
        devManager = ((DevSupportManagerImpl) instanceManager.getDevSupportManager());
    }
}
 
開發者ID:jhen0409,項目名稱:react-native-devsettings-android,代碼行數:13,代碼來源:DevSettingsModule.java

示例4: getTaskConfig

import com.facebook.react.ReactApplication; //導入依賴的package包/類
@Nullable @Override protected HeadlessJsTaskConfig getTaskConfig(Intent intent) {
  Log.d(LOG_TAG, "getTaskConfig() called with: intent = [" + intent + "]");
  Bundle extras = intent.getExtras();
  boolean allowExecutionInForeground = extras.getBoolean("allowExecutionInForeground", false);
  long timeout = extras.getLong("timeout", 2000);
  // For task with quick execution period additional check is required
  ReactNativeHost reactNativeHost =
      ((ReactApplication) getApplicationContext()).getReactNativeHost();
  boolean appInForeground = Utils.isReactNativeAppInForeground(reactNativeHost);
  if (appInForeground && !allowExecutionInForeground) {
    return null;
  }
  return new HeadlessJsTaskConfig(intent.getStringExtra("jobKey"), Arguments.fromBundle(extras),
      timeout, allowExecutionInForeground);
}
 
開發者ID:vikeri,項目名稱:react-native-background-job,代碼行數:16,代碼來源:ReactNativeEventStarter.java

示例5: RNSentryModule

import com.facebook.react.ReactApplication; //導入依賴的package包/類
public RNSentryModule(ReactApplicationContext reactContext, ReactApplication reactApplication) {
    super(reactContext);
    this.reactContext = reactContext;
    this.reactApplication = reactApplication;
    RNSentryModule.extra = new WritableNativeMap();
    RNSentryModule.packageInfo = getPackageInfo(reactContext);
}
 
開發者ID:getsentry,項目名稱:react-native-sentry,代碼行數:8,代碼來源:RNSentryModule.java

示例6: init

import com.facebook.react.ReactApplication; //導入依賴的package包/類
/**
 * Pre-load {@link ReactRootView} to local {@link Map}, you may want to
 * load it in previous activity.
 */
public static void init(Activity activity, ReactInfo reactInfo) {
    if (CACHE_VIEW_MAP.get(reactInfo.getMainComponentName()) != null) {
        return;
    }
    ReactRootView rootView = new ReactRootView(new MutableContextWrapper(activity));
    rootView.startReactApplication(
            ((ReactApplication) activity.getApplication()).getReactNativeHost().getReactInstanceManager(),
            reactInfo.getMainComponentName(),
            reactInfo.getLaunchOptions());
    CACHE_VIEW_MAP.put(reactInfo.getMainComponentName(), rootView);
}
 
開發者ID:markzhai,項目名稱:react-native-preloader,代碼行數:16,代碼來源:ReactPreLoader.java

示例7: sendTokenToJS

import com.facebook.react.ReactApplication; //導入依賴的package包/類
protected void sendTokenToJS() {
    final ReactInstanceManager instanceManager = ((ReactApplication) mAppContext).getReactNativeHost().getReactInstanceManager();
    final ReactContext reactContext = instanceManager.getCurrentReactContext();

    // Note: Cannot assume react-context exists cause this is an async dispatched service.
    if (reactContext != null && reactContext.hasActiveCatalystInstance()) {
        reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(TOKEN_RECEIVED_EVENT_NAME, sToken);
    }
}
 
開發者ID:wix,項目名稱:react-native-notifications,代碼行數:10,代碼來源:GcmToken.java

示例8: resolveInstanceManager

import com.facebook.react.ReactApplication; //導入依賴的package包/類
private ReactInstanceManager resolveInstanceManager() throws NoSuchFieldException, IllegalAccessException {
    ReactInstanceManager instanceManager;
    final Activity currentActivity = getCurrentActivity();
    if (currentActivity == null) {
        return null;
    }

    ReactApplication reactApplication = (ReactApplication) currentActivity.getApplication();
    instanceManager = reactApplication.getReactNativeHost().getReactInstanceManager();

    return instanceManager;
}
 
開發者ID:remobile,項目名稱:react-native-update,代碼行數:13,代碼來源:RCTUpdate.java

示例9: getReactInstanceManager

import com.facebook.react.ReactApplication; //導入依賴的package包/類
private ReactInstanceManager getReactInstanceManager() {
    ReactApplication reactApplication = (ReactApplication)getCurrentActivity().getApplication();
    return reactApplication.getReactNativeHost().getReactInstanceManager();
}
 
開發者ID:devfd,項目名稱:react-native-workers,代碼行數:5,代碼來源:WorkerModule.java

示例10: ReactNativeEventStarter

import com.facebook.react.ReactApplication; //導入依賴的package包/類
ReactNativeEventStarter(@NonNull Context context) {
  this.context = context;
  reactNativeHost = ((ReactApplication) context.getApplicationContext()).getReactNativeHost();
}
 
開發者ID:vikeri,項目名稱:react-native-background-job,代碼行數:5,代碼來源:ReactNativeEventStarter.java

示例11: RNSentryPackage

import com.facebook.react.ReactApplication; //導入依賴的package包/類
public RNSentryPackage(ReactApplication reactApplication) {
    this.reactApplication = reactApplication;
}
 
開發者ID:getsentry,項目名稱:react-native-sentry,代碼行數:4,代碼來源:RNSentryPackage.java

示例12: getReactApplication

import com.facebook.react.ReactApplication; //導入依賴的package包/類
public ReactApplication getReactApplication() {
    return reactApplication;
}
 
開發者ID:getsentry,項目名稱:react-native-sentry,代碼行數:4,代碼來源:RNSentryPackage.java

示例13: GcmToken

import com.facebook.react.ReactApplication; //導入依賴的package包/類
protected GcmToken(Context appContext) {
    if (!(appContext instanceof ReactApplication)) {
        throw new IllegalStateException("Application instance isn't a react-application");
    }
    mAppContext = appContext;
}
 
開發者ID:wix,項目名稱:react-native-notifications,代碼行數:7,代碼來源:GcmToken.java

示例14: getReactNativeHost

import com.facebook.react.ReactApplication; //導入依賴的package包/類
/**
 * Get the {@link ReactNativeHost} used by this app. By default, assumes
 * {@link Activity#getApplication()} is an instance of {@link ReactApplication} and calls
 * {@link ReactApplication#getReactNativeHost()}. Override this method if your application class
 * does not implement {@code ReactApplication} or you simply have a different mechanism for
 * storing a {@code ReactNativeHost}, e.g. as a static field somewhere.
 */
protected ReactNativeHost getReactNativeHost() {
    return ((ReactApplication) getActivity().getApplication()).getReactNativeHost();
}
 
開發者ID:hudl,項目名稱:react-native-android-fragment,代碼行數:11,代碼來源:ReactFragment.java

示例15: getReactNativeHost

import com.facebook.react.ReactApplication; //導入依賴的package包/類
/**
 * Get the {@link ReactNativeHost} used by this app. By default, assumes {@link #getApplication()}
 * is an instance of {@link ReactApplication} and calls
 * {@link ReactApplication#getReactNativeHost()}. Override this method if your application class
 * does not implement {@code ReactApplication} or you simply have a different mechanism for
 * storing a {@code ReactNativeHost}, e.g. as a static field somewhere.
 */
protected ReactNativeHost getReactNativeHost() {
    return ((ReactApplication) getApplication()).getReactNativeHost();
}
 
開發者ID:markzhai,項目名稱:react-native-preloader,代碼行數:11,代碼來源:MrReactActivity.java


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