Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript React Native-iOS-本地映像不可见(适用于android)_Javascript_Ios_Reactjs_React Native_Expo - Fatal编程技术网

Javascript React Native-iOS-本地映像不可见(适用于android)

Javascript React Native-iOS-本地映像不可见(适用于android),javascript,ios,reactjs,react-native,expo,Javascript,Ios,Reactjs,React Native,Expo,我正在用嵌套在其中的图像映射TouchableOpacity。它在安卓系统上运行得很好,但在iOS上图像是看不见的。我仍然可以点击75x75可触摸不透明度,但图像在弹出的模式中是不可见的 这是怎么回事? 我使用Expo SDK文件系统获取每个映像的路径 例如:file://path/to/container/progress/myfilehash.jpg 我将其推送到我的状态,并将其映射到组件中。require()函数无法按我的方式工作。我认为这纯粹是渲染的问题 地图代码: {this.stat

我正在用嵌套在其中的图像映射TouchableOpacity。它在安卓系统上运行得很好,但在iOS上图像是看不见的。我仍然可以点击75x75可触摸不透明度,但图像在弹出的模式中是不可见的

这是怎么回事? 我使用Expo SDK文件系统获取每个映像的路径

例如:file://path/to/container/progress/myfilehash.jpg

我将其推送到我的状态,并将其映射到组件中。require()函数无法按我的方式工作。我认为这纯粹是渲染的问题

地图代码:

{this.state.images.map((val, key) => (
  <TouchableOpacity
    key={key}
    onPress={() => this.setState({active: val, modal: true})}
  >
    <Image
      style={{width: 75, height: 75}}
      source={{isStatic: true, uri: val}}
    />
  </TouchableOpacity>
))}

我也曾经遇到过这个问题,我通过将图像粘贴到根文件夹中解决了这个问题,然后在图像源标记中使用了该路径。

@Luminosity,您设置了图片的大小了吗?是的,在示例和说明中,您可以看到我将其设置为75px乘以75px。@Luminosity,很抱歉没有设置。我只记得那是我以前遇到的一个问题。如果您将按钮的背景色更改为红色或其他颜色,是否会占用您期望图片的空间?您是否尝试过使用其他图像?通常一些图片无法加载到某些设备中,因为尺寸太大。试着用同样的方法检查其他图像是否有问题没有世博集装箱工作期间的图像。先生,我不确定您是否理解这个问题的背景。
<Container style={Colors.Backdrop}>
  <Header style={Colors.Navbar}>
    <Left>
      <TouchableHighlight
        onPress={() => {
          this.setState({modal: false})
      }}>
        <Icon
          name="arrow-back"
          style={{color: 'white'}}
        />
      </TouchableHighlight>
    </Left>
    <Body></Body>
    <Right>
      <TouchableOpacity
        onPress={() => {
        this._deleteImage(this.state.active);
      }}>
        <Text
          style={[
            Colors.ErrorText, {
              fontSize: 24,
              marginRight: 10
            }
        ]}>&times;</Text>
      </TouchableOpacity>
    </Right>
  </Header>
  <Content>
    <View
      style={{flex: 1}}
    >
      <FitImage
        source={{uri: this.state.active}}
      />
    </View>
  </Content>
</Container>
_getAllImagesInDirectory = async() => {
    let dir = await FileSystem.readDirectoryAsync(FileSystem.documentDirectory + 'progress');

    dir.forEach((val) => {
      this.state.images.push(Platform.OS === 'ios' ? FileSystem.documentDirectory.substring(7, FileSystem.documentDirectory.length) : FileSystem.documentDirectory + 'progress/' + val);
    });

    await this.setState({images: this.state.images, loading: false});
}