react-native: Image headers and method not working on Android

My dependencies:

    "expo": "^34.0.1",
    "react": "16.8.3",
    "react-dom": "^16.8.6",
    "react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
    "react-native-web": "^0.11.4"

Bug: In the source field of any Image , only the uri attribute is working. The method and the headers are not working. If i check my apache logs, headers are not sent and the request method is GET. I’ve also tested with websites like https://webhook.site

This bug is only present on Android, i tested on IOS and it works just fine

Reproduce:

import React from 'react';
import { StyleSheet, Text, View, Image } from 'react-native';

export default function App() {
  return (
    <View style={styles.container}>
      <Image
        source={{
          uri: 'http://localhost/api/me/video/31/thumbnail'+Date.now(),
          method: 'POST',
          headers: {
            Pragma: 'no-cache',
          },
          body: 'Your Body goes here',
        }}
        style={{width: 400, height: 400}}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Snack: https://snack.expo.io/SktKlBPXS

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 26

Most upvoted comments

Same issue, can’t pass bearer token on Android. Works on iOS.

any news ??

I had same issue, the headers stopped being sent on android for no reason. Clearing expo data and cache in phone’s settings helped.

The method being ignored is not much of a problem, since loading an image should always be a GET request, but the headers are the real problem. I’m not sure how we are supposed to load a protected image if we can’t pass a token (ie: Bearer) to the request.

@dhcmega same here but the solution not found in React native 0.63.2 too.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community’s attention? This issue may be closed if no further activity occurs. You may also label this issue as a “Discussion” or add it to the “Backlog” and I will leave it open. Thank you for your contributions.

Same issue here! Any solution?