我想使用 react-native-image-picker 捕获多个图像

I Want to capture multiple images using react-native-image-picker

  // add no of images equal to Qty

handleQuantity(qty) {
    this.setState({ qty: qty })
    for (let i = 0; i < qty; i++) {
        this.selectPhotoTapped(i)
    }

}



selectPhotoTapped(count) {
    const options = {
        quality: 1.0,
        maxWidth: 500,
        maxHeight: 500,
        storageOptions: {
            skipBackup: true
        }
    };

    ImagePicker.launchCamera(options, (response) => {
        console.log(response);
        if (response.didCancel) {
            console.log('User cancelled photo picker');
        }
        else if (response.error) {
            console.log('ImagePicker Error: ', response.error);
        }
        else {
            //let source = { uri: response.uri };
            // this.setState({
            //     ImageSourceArr: [...this.state.ImageSourceArr, source]
            // });
            Realm.open(databaseOptions).then(realm => {
                realm.write(() => {
                    realm.create(Images_SCHEMA, {
                        id: count,
                        path: response.uri
                    });

                    // this.setState({ size: realm.objects(Images_SCHEMA).length });
                    const res = realm.objects(Images_SCHEMA)
                    let res2 = JSON.parse(JSON.stringify(res))
                    for (let key in res2) {
                        this.setState({
                            ImageSourceArr: [...this.state.ImageSourceArr, res2[key].path],
                            size: realm.objects(Images_SCHEMA).length
                        });
                    }
                });
            });

        }

    });

}

handleQuantity() 函数调用次数 selectedPhototap() 函数 和 selectedPhotoTap() 函数将路径插入领域,但问题是它只存储最后一个图像路径,我想插入通过函数 selectedPhotoTap 捕获的所有图像 请任何人帮助我

react-native-image-picker does not support for multiple image selection, crop tool, and landscape support for native iOS functionality - not issues with the library. If you need these things, react-native-image-crop-picker might be a better choice for you.

https://github.com/ivpusic/react-native-image-crop-picker