CameraRoll拿到的图片路径



  • 我用原生的CameraRoll 想取得相簿里面每张图片的路径

    已下是我的程式码 拿出的路径都是content:// 就是只取得Uri

    要怎么做才能拿到在系统的真实位置呀

    componentDidMount() {
    let assetLibraryArr = []

        let assetType = 'Photos'
    
        var fetchParams = {
            first: 500,
            assetType: assetType,
        }
        // var RNGRP = require('react-native-get-real-path');
    
        CameraRoll.getPhotos(fetchParams)
            .then((data) => {
                // console.info("[PickerImageView] CameraRoll.getPhotos")
                // console.log("照片總數: " + data.edges.length)
                data.edges.map(function(item){
                    assetLibraryArr.push({
                        source: item.node.image.uri,
                        isWillDelete: false,
                        description: '',
                    })
                })
                this.setState({
                    assetLibraryArr: assetLibraryArr,
                    dataSource: this.state.dataSource.cloneWithRows(assetLibraryArr)
                })
    
            }, (e) => {
                console.log(source)
            });
    }

登录后回复