-
public class ThemedReactContext extends ReactContext
Wraps ReactContext with the base Context passed into the constructor. It provides also a way to start activities using the viewContext to which RN native views belong. It delegates lifecycle listener registration to the original instance of ReactContext which is supposed to receive the lifecycle events. At the same time we disallow receiving lifecycle events for this wrapper instances. TODO: T7538544 Rename ThemedReactContext to be in alignment with name of ReactApplicationContext
-
-
Constructor Summary
Constructors Constructor Description ThemedReactContext(ReactApplicationContext reactApplicationContext, Context base)
ThemedReactContext(ReactApplicationContext reactApplicationContext, Context base, String moduleName)
ThemedReactContext(ReactApplicationContext reactApplicationContext, Context base, String moduleName, int surfaceId)
-
Method Summary
Modifier and Type Method Description void
addLifecycleEventListener(LifecycleEventListener listener)
void
removeLifecycleEventListener(LifecycleEventListener listener)
boolean
hasCurrentActivity()
Activity
getCurrentActivity()
Get the activity to which this context is currently attached, or {@code null}
if not attached.DO NOT HOLD LONG-LIVED REFERENCES TO THE OBJECT RETURNED BY THIS METHOD, AS THIS WILL CAUSEMEMORY LEAKS.String
getSurfaceID()
This is misnamed but has some uses out in the wild. String
getModuleName()
int
getSurfaceId()
ReactApplicationContext
getReactApplicationContext()
boolean
isBridgeless()
JSIModule
getJSIModule(JSIModuleType moduleType)
-
Methods inherited from class com.facebook.react.bridge.ReactContext
addActivityEventListener, addLifecycleEventListener, addWindowFocusChangeListener, assertOnJSQueueThread, assertOnNativeModulesQueueThread, assertOnNativeModulesQueueThread, assertOnUiQueueThread, destroy, getCatalystInstance, getExceptionHandler, getJSModule, getJavaScriptContextHolder, getLifecycleState, getNativeModule, getNativeModules, getSourceURL, getSystemService, handleException, hasActiveCatalystInstance, hasActiveReactInstance, hasCatalystInstance, hasNativeModule, initializeMessageQueueThreads, initializeWithInstance, isOnJSQueueThread, isOnNativeModulesQueueThread, isOnUiQueueThread, onActivityResult, onHostDestroy, onHostPause, onHostResume, onNewIntent, onWindowFocusChange, registerSegment, removeActivityEventListener, removeWindowFocusChangeListener, resetPerfStats, runOnJSQueueThread, runOnNativeModulesQueueThread, runOnUiQueueThread, setNativeModuleCallExceptionHandler, startActivityForResult
-
Methods inherited from class android.content.ContextWrapper
bindIsolatedService, bindService, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingOrSelfUriPermissions, checkCallingPermission, checkCallingUriPermission, checkCallingUriPermissions, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermissions, clearWallpaper, createAttributionContext, createConfigurationContext, createContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getAttributionSource, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDataDir, getDatabasePath, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFileStreamPath, getFilesDir, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getParams, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, isUiContext, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, peekWallpaper, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, startActivities, startActivity, startForegroundService, startInstrumentation, startIntentSender, startService, stopService, unbindService, unregisterReceiver, updateServiceGroup
-
Methods inherited from class android.content.Context
getColor, getColorStateList, getDrawable, getString, getSystemService, getText, obtainStyledAttributes, registerComponentCallbacks, sendBroadcastWithMultiplePermissions, unregisterComponentCallbacks
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ThemedReactContext
ThemedReactContext(ReactApplicationContext reactApplicationContext, Context base)
-
ThemedReactContext
ThemedReactContext(ReactApplicationContext reactApplicationContext, Context base, String moduleName)
-
ThemedReactContext
ThemedReactContext(ReactApplicationContext reactApplicationContext, Context base, String moduleName, int surfaceId)
-
-
Method Detail
-
addLifecycleEventListener
void addLifecycleEventListener(LifecycleEventListener listener)
-
removeLifecycleEventListener
void removeLifecycleEventListener(LifecycleEventListener listener)
-
hasCurrentActivity
boolean hasCurrentActivity()
-
getCurrentActivity
@Nullable() Activity getCurrentActivity()
Get the activity to which this context is currently attached, or
{@code null}
if not attached.DO NOT HOLD LONG-LIVED REFERENCES TO THE OBJECT RETURNED BY THIS METHOD, AS THIS WILL CAUSEMEMORY LEAKS.
-
getSurfaceID
@Deprecated()@Nullable() String getSurfaceID()
This is misnamed but has some uses out in the wild. It will be deleted in a future release ofRN.
-
getModuleName
@Nullable() String getModuleName()
-
getSurfaceId
int getSurfaceId()
-
getReactApplicationContext
ReactApplicationContext getReactApplicationContext()
-
isBridgeless
boolean isBridgeless()
-
getJSIModule
JSIModule getJSIModule(JSIModuleType moduleType)
-
-
-
-