Add layout transitions to the composer photo gallery on iOS (#3609)
* add layoutanimation + transition to images * make iOS-only * use useLayoutEffect * make iOS only (again)zio/stable
parent
bef7d8a325
commit
1a5b8b2c94
|
@ -1,9 +1,17 @@
|
||||||
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
|
import React, {
|
||||||
|
useCallback,
|
||||||
|
useEffect,
|
||||||
|
useLayoutEffect,
|
||||||
|
useMemo,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
} from 'react'
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
BackHandler,
|
BackHandler,
|
||||||
Keyboard,
|
Keyboard,
|
||||||
KeyboardAvoidingView,
|
KeyboardAvoidingView,
|
||||||
|
LayoutAnimation,
|
||||||
Platform,
|
Platform,
|
||||||
Pressable,
|
Pressable,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
|
@ -122,6 +130,13 @@ export const ComposePost = observer(function ComposePost({
|
||||||
() => new GalleryModel(initImageUris),
|
() => new GalleryModel(initImageUris),
|
||||||
[initImageUris],
|
[initImageUris],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
if (isIOS) {
|
||||||
|
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)
|
||||||
|
}
|
||||||
|
}, [gallery.size])
|
||||||
|
|
||||||
const onClose = useCallback(() => {
|
const onClose = useCallback(() => {
|
||||||
closeComposer()
|
closeComposer()
|
||||||
}, [closeComposer])
|
}, [closeComposer])
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
import React, {useState} from 'react'
|
import React, {useState} from 'react'
|
||||||
import {ImageStyle, Keyboard, LayoutChangeEvent} from 'react-native'
|
import {ImageStyle, Keyboard, LayoutChangeEvent} from 'react-native'
|
||||||
import {GalleryModel} from 'state/models/media/gallery'
|
|
||||||
import {observer} from 'mobx-react-lite'
|
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
|
||||||
import {s, colors} from 'lib/styles'
|
|
||||||
import {StyleSheet, TouchableOpacity, View} from 'react-native'
|
import {StyleSheet, TouchableOpacity, View} from 'react-native'
|
||||||
import {Image} from 'expo-image'
|
import {Image} from 'expo-image'
|
||||||
import {Text} from 'view/com/util/text/Text'
|
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||||
import {Dimensions} from 'lib/media/types'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
|
import {useLingui} from '@lingui/react'
|
||||||
|
import {observer} from 'mobx-react-lite'
|
||||||
|
|
||||||
|
import {useModalControls} from '#/state/modals'
|
||||||
import {usePalette} from 'lib/hooks/usePalette'
|
import {usePalette} from 'lib/hooks/usePalette'
|
||||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
||||||
import {Trans, msg} from '@lingui/macro'
|
import {Dimensions} from 'lib/media/types'
|
||||||
import {useLingui} from '@lingui/react'
|
import {colors, s} from 'lib/styles'
|
||||||
import {useModalControls} from '#/state/modals'
|
|
||||||
import {isNative} from 'platform/detection'
|
import {isNative} from 'platform/detection'
|
||||||
|
import {GalleryModel} from 'state/models/media/gallery'
|
||||||
|
import {Text} from 'view/com/util/text/Text'
|
||||||
|
|
||||||
const IMAGE_GAP = 8
|
const IMAGE_GAP = 8
|
||||||
|
|
||||||
|
@ -197,6 +198,7 @@ const GalleryInner = observer(function GalleryImpl({
|
||||||
}}
|
}}
|
||||||
accessible={true}
|
accessible={true}
|
||||||
accessibilityIgnoresInvertColors
|
accessibilityIgnoresInvertColors
|
||||||
|
transition={200}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
|
|
Loading…
Reference in New Issue