本文整理匯總了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;
}
示例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());
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例9: getReactInstanceManager
import com.facebook.react.ReactApplication; //導入依賴的package包/類
private ReactInstanceManager getReactInstanceManager() {
ReactApplication reactApplication = (ReactApplication)getCurrentActivity().getApplication();
return reactApplication.getReactNativeHost().getReactInstanceManager();
}
示例10: ReactNativeEventStarter
import com.facebook.react.ReactApplication; //導入依賴的package包/類
ReactNativeEventStarter(@NonNull Context context) {
this.context = context;
reactNativeHost = ((ReactApplication) context.getApplicationContext()).getReactNativeHost();
}
示例11: RNSentryPackage
import com.facebook.react.ReactApplication; //導入依賴的package包/類
public RNSentryPackage(ReactApplication reactApplication) {
this.reactApplication = reactApplication;
}
示例12: getReactApplication
import com.facebook.react.ReactApplication; //導入依賴的package包/類
public ReactApplication getReactApplication() {
return reactApplication;
}
示例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;
}
示例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();
}
示例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();
}