How to use the @react-native-community/cameraroll.getPhotos function in @react-native-community/cameraroll

To help you get started, we’ve selected a few @react-native-community/cameraroll examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Doha26 / Instagram-clone / src / components / cameraRollPicker / index.tsx View on Github external
var fetchParams = {
            first: 1000,
            groupTypes: groupTypes,
            assetType: assetType,
        };

        if (Platform.OS === "android") {
            // not supported in android
            delete fetchParams.groupTypes;
        }

        if (this.state.lastCursor) {
            fetchParams.after = this.state.lastCursor;
        }

        CameraRoll.getPhotos(fetchParams)
            .then((data) => this._appendImages(data), (e) => console.log(e));
    }
github jeanpan / react-native-camera-roll-picker / index.js View on Github external
const fetchParams = {
      first: 100,
      groupTypes,
      assetType,
    };

    if (Platform.OS === 'android') {
      // not supported in android
      delete fetchParams.groupTypes;
    }

    if (this.state.lastCursor) {
      fetchParams.after = this.state.lastCursor;
    }

    CameraRoll.getPhotos(fetchParams)
      .then(data => this.appendImages(data), e => console.log(e));
  }
github Doha26 / Instagram-clone / src / screens / Search / index.tsx View on Github external
componentDidMount() {
        const fetchParams = {
            first: 25,
        };
        CameraRoll.getPhotos(fetchParams).then((data: any) => {
            const assets = data.edges;
            const images = assets.map((asset: any) => asset.node.image);
            this.setState({
                tmpImages: images,
            });
            const imgArray: any = [];
            this.state.tmpImages.forEach(function (image: any, index: number) {
                imgArray.push({uri: image.uri, id: index, height: Math.round(Math.random() * 50 + 100)})
            });
            this.setState({images: imgArray});
        }).catch((err: any) => {
            console.log("Error retrieving photos");
        });
    }
github Doha26 / Instagram-clone / src / screens / Root / index.tsx View on Github external
componentDidMount(): void {
        const fetchParams = {
            first: 25,
        };
        CameraRoll.getPhotos(fetchParams).then((data: any) => {
            const assets = data.edges;
            const images = assets.map((asset: any) => asset.node.image);
            this.setState({
                tmpImages: images,
            });
            const imgArray: any = [];
            this.state.tmpImages.forEach(function (image: any, index: number) {
                imgArray.push({uri: image.uri, id: index, height: Math.round(Math.random() * 50 + 100)})
            });
            this.setState({images: imgArray});
            
            this.onBlurViewLoaded.bind(this)
        }).catch((err: any) => {
            console.log("Error retrieving photos");
        });
    }
github berty / berty / js / packages / components / chat / file-uploads / GallerySection.tsx View on Github external
async function getInitalGalleryContents() {
		try {
			const photos = await CameraRoll.getPhotos({
				first: GALLERY_IMAGE_PER_PAGE,
			})

			setGalleryContents(
				photos.edges.map(({ node: { image: { filename, uri }, type: mime } }) => ({
					filename: filename || '',
					uri,
					mimeType: mime,
				})),
			)

			setGalleryImageEndCursor(photos.page_info.has_next_page ? photos.page_info.end_cursor : null)
		} catch (err) {
			console.log('getPhotos err', err)
		}
	}

@react-native-community/cameraroll

React Native Camera Roll for iOS & Android

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis