add layout animations to gallery
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
import {makeAutoObservable, runInAction} from 'mobx'
|
import {LayoutAnimation} from 'react-native'
|
||||||
import {ImageModel} from './image'
|
|
||||||
import {Image as RNImage} from 'react-native-image-crop-picker'
|
import {Image as RNImage} from 'react-native-image-crop-picker'
|
||||||
import {openPicker} from 'lib/media/picker'
|
import {makeAutoObservable, runInAction} from 'mobx'
|
||||||
|
|
||||||
import {getImageDim} from 'lib/media/manip'
|
import {getImageDim} from 'lib/media/manip'
|
||||||
|
import {openPicker} from 'lib/media/picker'
|
||||||
|
import {ImageModel} from './image'
|
||||||
|
|
||||||
interface InitialImageUri {
|
interface InitialImageUri {
|
||||||
uri: string
|
uri: string
|
||||||
@@ -63,6 +65,7 @@ export class GalleryModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
|
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)
|
||||||
this.add(image)
|
this.add(image)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -76,6 +79,7 @@ export class GalleryModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
remove(image: ImageModel) {
|
remove(image: ImageModel) {
|
||||||
|
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)
|
||||||
const index = this.images.findIndex(image_ => image_.path === image.path)
|
const index = this.images.findIndex(image_ => image_.path === image.path)
|
||||||
this.images.splice(index, 1)
|
this.images.splice(index, 1)
|
||||||
}
|
}
|
||||||
@@ -90,6 +94,7 @@ export class GalleryModel {
|
|||||||
allowsMultipleSelection: true,
|
allowsMultipleSelection: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)
|
||||||
return await Promise.all(
|
return await Promise.all(
|
||||||
images.map(image => {
|
images.map(image => {
|
||||||
this.add(image)
|
this.add(image)
|
||||||
|
|||||||
Reference in New Issue
Block a user