mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
d37baa78f1
Summary: It turns out the ImageLoader native module has different method signatures on iOS than on Android, so the JS spec we currently have won't work for ANdroid. In this diff I'm splitting up the spec for NativeImageLoader into an Android & iOS versions (similar to PlatformConstants), and updating the Android spec to match the native implementation. I'm also changing `RCTImageLoader` to use the new generated spec, and updating the JS callers (`Image.android.js` and `Image.ios.js`) to use the right one for the platform (instead of importing the untyped `ImageLoader` native module from `react-native`, like we were on Android :-/). This will be a breaking change for anyone who's directly using `NativeImageLoader.js`, but I think most callsites should be using the `Image` component instead. Changelog: [General] [Changed] Split NativeImageLoader into NativeImageLoaderAndroid and NativeImageLoaderIOS Reviewed By: RSNara Differential Revision: D18439538 fbshipit-source-id: 94c796d3fd27800ea17053e963bee51aca921718
44 lines
1.4 KiB
Java
44 lines
1.4 KiB
Java
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
|
* directory of this source tree.
|
|
*
|
|
* <p>Generated by an internal genrule from Flow types.
|
|
*
|
|
* @generated
|
|
* @nolint
|
|
*/
|
|
|
|
package com.facebook.fbreact.specs;
|
|
|
|
import com.facebook.react.bridge.Promise;
|
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
import com.facebook.react.bridge.ReactMethod;
|
|
import com.facebook.react.bridge.ReactModuleWithSpec;
|
|
import com.facebook.react.bridge.ReadableArray;
|
|
import com.facebook.react.bridge.ReadableMap;
|
|
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
|
|
public abstract class NativeImageLoaderAndroidSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule {
|
|
public NativeImageLoaderAndroidSpec(ReactApplicationContext reactContext) {
|
|
super(reactContext);
|
|
}
|
|
|
|
@ReactMethod
|
|
public abstract void getSize(String uri, Promise promise);
|
|
|
|
@ReactMethod
|
|
public abstract void abortRequest(double requestId);
|
|
|
|
@ReactMethod
|
|
public abstract void prefetchImage(String uri, double requestId, Promise promise);
|
|
|
|
@ReactMethod
|
|
public abstract void queryCache(ReadableArray uris, Promise promise);
|
|
|
|
@ReactMethod
|
|
public abstract void getSizeWithHeaders(String uri, ReadableMap headers, Promise promise);
|
|
}
|