【问题标题】:React-native-image-picker: How to access gallery images directly in grid fashionReact-native-image-picker:如何以网格方式直接访问画廊图像
【发布时间】:2018-08-02 09:32:49
【问题描述】:

我正在使用 react-native-image-picker,我想直接从设备访问图库图片。但是,当我使用以下方法启动 ImageLibrary 时,我会看到另外 2 个选项,分别是“图片”、“下载”。

相反,我希望以网格方式查看所有库图像,如下所示。

ImagePicker.launchImageLibrary(options, (response)  => {
     if (response.didCancel) {
       console.log('User cancelled photo picker');
     }
     else if (response.error) {
       console.log('ImagePicker Error: ', response.error);
     }
     else if (response.customButton) {
       console.log('User tapped custom button: ', response.customButton);
     }
     else {
       this.props.navigation.navigate('AddImage', {uri: response.uri, addImage: this.addImage.bind(this)});
     }
   });

【问题讨论】:

  • 可能有点晚了,但你为什么不实现自己的画廊视图呢?

标签: react-native react-native-image-picker


【解决方案1】:

我有一点想法,但你问的不多。 它只是直接启动相机和图像库而已。或许对你有帮助。

// Launch Camera:
ImagePicker.launchCamera(options, (response) => {
  // Same code as in above section!
});

// Open Image Library:
ImagePicker.launchImageLibrary(options, (response) => {
  // Same code as in above section!
});

更多,请点击here

【讨论】:

    猜你喜欢
    • 2021-05-11
    • 1970-01-01
    • 2020-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-20
    • 2019-05-29
    相关资源
    最近更新 更多