uri图像未在React native Image视图中呈现

Rag*_* db 6 android image reactjs react-native

我是React Native开发和使用React Native开发android应用程序的新手。我有一个个人资料页面,我试图在其中显示姓名和联系方式,如下所示。

return(
    <View style={{flex: 1}}>
      <ScrollView contentContainerStyle={styles.contentContainer}>
      <View style={styles.card}>
        <View style={styles.horizontalCard}>
        <Image
          style={{width: 34, height: 34}}
          source={{uri: 
       'http://test.abc.com/appdummyurl/images/mobile.png'}}
        />
          <Text style={styles.header}>{this.state.user_email}</Text>
        </View>

        <View style={styles.horizontalCard}>
        <Image
          style={{width: 34, height: 34}}
          source={{uri: 
      'http://test.abc.com/appdummyurl/images/images/profile.png'}}
        />
          <Text style={styles.header}>{this.state.user_no}</Text>
        </View>

        </View>    

    </ScrollView>
    <TouchableOpacity onPress={this.logOut}>
            <View style={styles.BottonCard}>
              <Text style={styles.Btntext}>LOG OUT</Text>
            </View>
          </TouchableOpacity>
  </View>
);
Run Code Online (Sandbox Code Playgroud)

除了第一个图像正在加载到第一个图像视图,第二个图像显示空白处,一切正常。请帮我弄清楚。

另外,请指导我如何使用变量代替图片网址。

Her*_*ngh 6

可能是您的网络速度较慢,或者图像路径不正确或服务器问题。您必须在google的任何虚拟图像路径上测试这种情况。例如使用这个

<Image
      style={{width: 100, height: 100}}
      source={{uri: 
   'https://www.planwallpaper.com/static/images/9-credit-1.jpg'
    }}/>
Run Code Online (Sandbox Code Playgroud)