title: React Native disable Fresco image downsampling
body: <p>I need to disable <em>Fresco</em> downsampling for the <code>&lt;Image/&gt;</code> component and I read that <em>Fresco</em> needs to be initialized inside <code>android/app/src/main/java/com/&lt;project&gt;/MainApplication.java</code>.</p>
  
  <p><a href="https://frescolib.org/docs/resizing.html" rel="nofollow noreferrer">Fresco > Resizing/Downsampling</a><br>
  <a href="https://frescolib.org/docs/configure-image-pipeline.html" rel="nofollow noreferrer">Fresco > Configuring the Image Pipeline</a><br>
  <a href="https://stackoverflow.com/questions/53402308/react-native-0-57-x-image-large-images-low-quality">RN issue report</a></p>
  
  <p>I found two ways to do it but none of the themes worked and couldn't have <em>Fresco</em> image downsampling disabled:</p>
  
  <p>1st override <code>onCreate</code> and initialize <em>Fresco</em> like this:</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>@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);
  }
  </code></pre>
  
  <p>2nd initialize Fresco using <code>MainReactPackage</code> inside <code>getPackages</code>:</p>
  
  <pre class="lang-java prettyprint-override"><code>protected List&lt;ReactPackage&gt; getPackages() {
    Context context = getApplicationContext();
    ImagePipelineConfig frescoConfig = ImagePipelineConfig.newBuilder(context)
      .setDownsampleEnabled(false)
      .build();
  
    MainPackageConfig appConfig = new MainPackageConfig
      .Builder()
      .setFrescoConfig(frescoConfig)
      .build();
  
    return new ArrayList&lt;&gt;(Arrays.&lt;ReactPackage&gt;asList(
      new MainReactPackage(appConfig),
      new ReactNativeFirebaseAppPackage(),
      new FastImageViewPackage()
    ));
  }
  </code></pre>
  
  <p>I'm currently on <em>RN 0.60.5</em> and I'm extending <code>MainApplication</code> with <code>com.reactnativenavigation.NavigationApplication</code> because I'm using <a href="https://github.com/wix/react-native-navigation" rel="nofollow noreferrer">react-native-navigation</a>.</p>
  
  <p>My question is how can I disable <em>Fresco</em> image downsampling.</p>