public class ImageLoaderModule extends ReactContextBaseJavaModule implements LifecycleEventListener
NativeModule.NativeMethodMETHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC| Constructor and Description |
|---|
ImageLoaderModule(ReactApplicationContext reactContext) |
ImageLoaderModule(ReactApplicationContext reactContext,
java.lang.Object callerContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
abortRequest(int requestId) |
java.lang.String |
getName() |
void |
getSize(java.lang.String uriString,
Promise promise)
Fetch the width and height of the given image.
|
void |
onHostDestroy()
Called when host activity receives destroy event (e.g.
|
void |
onHostPause()
Called when host activity receives pause event (e.g.
|
void |
onHostResume()
Called either when the host activity receives a resume event (e.g.
|
void |
prefetchImage(java.lang.String uriString,
int requestId,
Promise promise)
Prefetches the given image to the Fresco image disk cache.
|
void |
queryCache(ReadableArray uris,
Promise promise) |
getCurrentActivity, getReactApplicationContextcanOverrideExistingModule, getConstants, hasConstants, initialize, onCatalystInstanceDestroypublic ImageLoaderModule(ReactApplicationContext reactContext)
public ImageLoaderModule(ReactApplicationContext reactContext, java.lang.Object callerContext)
public java.lang.String getName()
getName in interface NativeModulerequire() this module
from javascript.public void getSize(java.lang.String uriString,
Promise promise)
uriString - the URI of the remote image to prefetchpromise - the promise that is fulfilled when the image is successfully prefetched
or rejected when there is an errorpublic void prefetchImage(java.lang.String uriString,
int requestId,
Promise promise)
uriString - the URI of the remote image to prefetchrequestId - the client-supplied request ID used to identify this requestpromise - the promise that is fulfilled when the image is successfully prefetched
or rejected when there is an errorpublic void abortRequest(int requestId)
public void queryCache(ReadableArray uris, Promise promise)
public void onHostResume()
LifecycleEventListenerActivity#onResume or
if the native module that implements this is initialized while the host activity is already
resumed. Always called for the most current activity.onHostResume in interface LifecycleEventListenerpublic void onHostPause()
LifecycleEventListenerActivity#onPause. Always called
for the most current activity.onHostPause in interface LifecycleEventListenerpublic void onHostDestroy()
LifecycleEventListenerActivity#onDestroy. Only called
for the last React activity to be destroyed.onHostDestroy in interface LifecycleEventListener