Upload image in composer (#27)
* upload images in composer v1 * fix android compile * reafctor image carousel into new component; fix photo overlapping text in composer * revert android changes * further refactoring code into different components * move show carousel out of the component * fixing add photo using camera * fix typescript issue; force mediatype photo * change post test with photo attached; remove auto linking settings * use runInAction in getPhotos model * react-hooks/exhaustive-deps fixes * crop every photo; make use of useCallback * moving placeholder condition * Cleanup Co-authored-by: Paul Frazee <pfrazee@gmail.com>
This commit is contained in:
parent
7ae1bac620
commit
67c4dcff37
10 changed files with 391 additions and 58 deletions
27
src/state/models/user-local-photos.ts
Normal file
27
src/state/models/user-local-photos.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import {PhotoIdentifier} from './../../../node_modules/@react-native-camera-roll/camera-roll/src/CameraRoll'
|
||||
import {makeAutoObservable, runInAction} 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 => {
|
||||
runInAction(() => {
|
||||
this.photos = r.edges
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue