public abstract class ReactContextBaseJavaModule extends BaseJavaModule
ReactContext
instance.NativeModule.NativeMethod
METHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC
Constructor and Description |
---|
ReactContextBaseJavaModule(ReactApplicationContext reactContext) |
Modifier and Type | Method and Description |
---|---|
protected android.app.Activity |
getCurrentActivity()
Get the activity to which this context is currently attached, or
null if not attached. |
protected ReactApplicationContext |
getReactApplicationContext()
Subclasses can use this method to access catalyst context passed as a constructor
|
canOverrideExistingModule, getConstants, hasConstants, initialize, onCatalystInstanceDestroy
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName
public ReactContextBaseJavaModule(ReactApplicationContext reactContext)
protected final ReactApplicationContext getReactApplicationContext()
protected final android.app.Activity getCurrentActivity()
null
if not attached.
DO NOT HOLD LONG-LIVED REFERENCES TO THE OBJECT RETURNED BY THIS METHOD, AS THIS WILL CAUSE
MEMORY LEAKS.
For example, never store the value returned by this method in a member variable. Instead, call
this method whenever you actually need the Activity and make sure to check for null
.