I need to disable Fresco downsampling for the <Image/>
component and I read that Fresco needs to be initialized inside android/app/src/main/java/com/<project>/MainApplication.java
.
Fresco > Resizing/Downsampling
Fresco > Configuring the Image Pipeline
RN issue report
I found two ways to do it but none of the themes worked and couldn't have Fresco image downsampling disabled:
1st override onCreate
and initialize Fresco like this:
@Override
public void onCreate() {
super.onCreate();
Context context = getApplicationContext();
ImagePipelineConfig config = ImagePipelineConfig.newBuilder(context)
.setDownsampleEnabled(false)
.build();
Fresco.initialize(context, config);
SoLoader.init(this, /* native exopackage */ false);
}
2nd initialize Fresco using MainReactPackage
inside getPackages
:
protected List<ReactPackage> getPackages() {
Context context = getApplicationContext();
ImagePipelineConfig frescoConfig = ImagePipelineConfig.newBuilder(context)
.setDownsampleEnabled(false)
.build();
MainPackageConfig appConfig = new MainPackageConfig
.Builder()
.setFrescoConfig(frescoConfig)
.build();
return new ArrayList<>(Arrays.<ReactPackage>asList(
new MainReactPackage(appConfig),
new ReactNativeFirebaseAppPackage(),
new FastImageViewPackage()
));
}
I'm currently on RN 0.60.5 and I'm extending MainApplication
with com.reactnativenavigation.NavigationApplication
because I'm using react-native-navigation.
My question is how can I disable Fresco image downsampling.