Camera Photos saved to FileSystem.documentDirectory with copyAsync missing after a new build


#1

I save images captured using Expo Camera to a device using the FileSystem.documentDirectory and FileSystem.copyAsync but when I publish an updated build of the App these photos are missing.

For Example, the image is saved to a FileSystem.documentDirectoryand I also save a reference to this image to AsyncStorage, E.g:

const USER_PHOTO_DIR = FileSystem.documentDirectory + 'photos';

handleImageSave = async photo => {
    const imageName = `${Date.now()}.jpg`;
    const photoSource = `${USER_PHOTO_DIR}/${imageName}`;

    await FileSystem.copyAsync({
      from: photo.uri,
      to: photoSource,
    });

    const image = {
      id: 'imgid-123',
      imageSrc: photoSource,
      createdAt: Date.now(),
    };

    // save to Redux / AsyncStorage 
    this.props.saveImage(image);
}

I thought the FileSystem.documentDirectory was persistent, so how can I use this to persist images across build updates?


closed #2

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.