facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.16k stars 24.21k forks source link

React Native Image Defaultsource not working on android #31287

Closed zoobibackups closed 3 years ago

zoobibackups commented 3 years ago

Here is my code. if I load the image as source then is working perfectly. but in defaultSource it is not working.

<Image style={{height:90,resizeMode:"cover", backgroundColor:"red", overflow:"hidden", width:90}} 
    defaultSource={require('../assets/default_profile.png')}
    source={{uri:`${master_api}/images/${num}.jpg`}} />

Here is My packge.json

{
  "name": "truecaller",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.13.3",
    "@react-native-community/art": "^1.2.0",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/cookies": "^5.0.1",
    "@react-native-community/google-signin": "^5.0.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/picker": "^1.8.1",
    "@react-native-community/slider": "^3.0.3",
    "@react-native-firebase/app": "^10.7.0",
    "@react-native-firebase/auth": "^10.7.0",
    "@react-navigation/bottom-tabs": "^5.11.8",
    "@react-navigation/drawer": "^5.12.2",
    "@react-navigation/material-bottom-tabs": "^5.3.14",
    "@react-navigation/native": "^5.9.3",
    "@react-navigation/stack": "^5.14.3",
    "@twotalltotems/react-native-otp-input": "^1.3.11",
    "faker": "^5.4.0",
    "google-libphonenumber": "^3.2.16",
    "install": "^0.13.0",
    "native-base": "^2.15.2",
    "npm": "^7.5.4",
    "react": "16.13.1",
    "react-native": "0.63.4",
    "react-native-admob": "^2.0.0-beta.6",
    "react-native-admob-native-ads": "^0.3.9",
    "react-native-android-notification-listener": "^2.0.0",
    "react-native-android-recyclerview": "^1.0.2",
    "react-native-animatable": "^1.3.3",
    "react-native-awesome-pin": "^1.3.1",
    "react-native-call-detection": "^1.9.0",
    "react-native-contacts": "^6.0.4",
    "react-native-fbsdk": "^3.0.0",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-image-crop-picker": "^0.36.0",
    "react-native-intent-launcher": "^0.2.1",
    "react-native-largelist": "^1.2.12",
    "react-native-largelist-v3": "^3.0.15",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-modal": "^11.6.1",
    "react-native-neomorph-shadows": "^1.1.2",
    "react-native-otp-textinput": "0.0.8",
    "react-native-paper": "^4.7.1",
    "react-native-reanimated": "^1.13.2",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.15.2",
    "react-native-shared-element": "^0.7.0",
    "react-native-spring-scrollview": "^2.0.23",
    "react-native-svg": "^12.1.0",
    "react-native-vector-icons": "^8.0.0",
    "react-navigation-shared-element": "^5.0.0-alpha1",
    "realm": "^10.2.0",
    "reanimated-bottom-sheet": "^1.0.0-alpha.22",
    "recyclerlistview": "^3.0.5"
  },
  "devDependencies": {
    "@babel/core": "^7.12.10",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.18.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.64.0",
    "react-native-svg-transformer": "^0.14.3",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  }
}
dulmandakh commented 3 years ago

Please read documentation carefully, and you'll find below note.

Note: On Android, the default source prop is ignored on debug builds.

wutiange commented 3 years ago

的确在 release 中能正常显示,但是我通过 code push 升级以后又不行了

safaiyeh commented 3 years ago

Please read documentation carefully, and you'll find below note.

Note: On Android, the default source prop is ignored on debug builds.

closing because of this

1mehdifaraji commented 2 years ago

It doen't work iOS either

Myzel394 commented 2 years ago

Please read documentation carefully, and you'll find below note.

Note: On Android, the default source prop is ignored on debug builds.

An explanation would be applicable