diff options
author | João Ferreiro <ferreiro@pinkroom.dev> | 2022-11-28 16:46:58 +0000 |
---|---|---|
committer | João Ferreiro <ferreiro@pinkroom.dev> | 2022-11-28 16:46:58 +0000 |
commit | 5ea750599d08229d4b5b10d0e724ca14c73735f5 (patch) | |
tree | 4e6f7511b054613b6d5ba189aeca692f95188953 /src/state/models | |
parent | f5ff0fd2749b5f9ebd9c6b4129513ff8ad577c00 (diff) | |
download | voidsky-5ea750599d08229d4b5b10d0e724ca14c73735f5.tar.zst |
upload images in composer v1
Diffstat (limited to 'src/state/models')
-rw-r--r-- | src/state/models/user-local-photos.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/state/models/user-local-photos.ts b/src/state/models/user-local-photos.ts new file mode 100644 index 000000000..4e01f1d94 --- /dev/null +++ b/src/state/models/user-local-photos.ts @@ -0,0 +1,25 @@ +import {PhotoIdentifier} from './../../../node_modules/@react-native-camera-roll/camera-roll/src/CameraRoll' +import {makeAutoObservable} from 'mobx' +import {CameraRoll} from '@react-native-camera-roll/camera-roll' +import {RootStoreModel} from './root-store' + +export class UserLocalPhotosModel { + // state + photos: PhotoIdentifier[] = [] + + constructor(public rootStore: RootStoreModel) { + makeAutoObservable(this, { + rootStore: false, + }) + } + + async setup() { + await this._getPhotos() + } + + private async _getPhotos() { + CameraRoll.getPhotos({first: 20}).then(r => { + this.photos = r.edges + }) + } +} |