我如何在本机模式中显示图像数组?

时间:2019-02-05 13:47:25

标签: reactjs react-native modal-dialog react-native-ios

我正在使用galleryswiper库在模态内显示图像数组,但是当我导航到模态组件并onPress模态打开时,我看不到任何图像。谁能帮助我如何在模态内部传递图像源?我也无法在按下图标时关闭模式。

export default class imagenav extends Component{
  constructor(props){
    super(props)
    state = {
      modalVisible: true,
    };
  }
  closeModal() {
    this.setState({modalVisible: false});
  }


render() {
  return (
      <Modal visible={this.modalVisible} onRequestClose={() => {} }> 
      <GallerySwiper
          style={{ flex: 1, backgroundColor: "black" }}
          images={[
            {source: {uri: 

              dimensions: {width: 1080, height: 1920}}
          }

          ]}
      />
      <Header
            style={{
              backgroundColor: 'black',
              borderBottomWidth: 0,
            }}
          > 
      <Right>
              <Icon
                name='close'
                color='white'
                onPress={() => {
                   this.setState({
                    modalVisible: false
                  })  
                  //this.closeModal()
                }}
              />
              </Right>
              </Header>

      </Modal>
  );
}
}

0 个答案:

没有答案