React native 如何使图像占据全屏?

React native 如何使图像占据全屏?,react-native,React Native,我有一个组件,当打电话时,它会显示手机整个屏幕的图像。问题是我无法使图像居中。它大部分在屏幕右侧,有些几乎看不见。如果有人知道我做错了什么,你的帮助将不胜感激。我正在使用react native image zoom,以便可以放大图像并向下滑动以消失 我的图像组件: const FullPicture = (props) => { return ( <View style={{ height: '100%', width: '100%' }}> <

我有一个组件,当打电话时,它会显示手机整个屏幕的图像。问题是我无法使图像居中。它大部分在屏幕右侧,有些几乎看不见。如果有人知道我做错了什么,你的帮助将不胜感激。我正在使用react native image zoom,以便可以放大图像并向下滑动以消失

我的图像组件:

const FullPicture = (props) => {
  return (
    <View style={{ height: '100%', width: '100%' }}>
      <ImageZoom
        cropWidth={Dimensions.get('window').width}
        cropHeight={Dimensions.get('window').height}
        enableSwipeDown
        onSwipeDown={() => props.closeImage()}
      >
        <Image
          style={{ height: props.picture.height, width: props.picture.width }}
          resizeMode={'cover'}
          source={{ uri: props.picture.uri }}
        />
      </ImageZoom>
    </View>
  );
};
你需要使用一种新的方法。尝试将flex:1添加到图像的容器:

<View style={{ flex: 1, height: '100%', width: '100%' }}>
  <ImageZoom> ... </ImageZoom>
</View>
你需要使用一种新的方法。尝试将flex:1添加到图像的容器:

<View style={{ flex: 1, height: '100%', width: '100%' }}>
  <ImageZoom> ... </ImageZoom>
</View>
试试这些:

在容器视图中设置flex:1 使用justifyContent:“中心” 退房

试试这些:

在容器视图中设置flex:1 使用justifyContent:“中心”
退房

这并没有解决问题。我在模态内部调用此组件,不确定这是否会影响它。这并没有解决问题。我在模态内部调用此组件,不确定这是否会影响它。这并没有解决问题。我在模态内部调用此组件,不确定这是否会影响它。这并没有解决问题。我在模态内部调用这个组件,不确定这是否会影响它。