merge in main
This commit is contained in:
@@ -107,7 +107,9 @@ export const ComposePost = observer(function ComposePost({
|
||||
text: initText,
|
||||
imageUris: initImageUris,
|
||||
cancelRef,
|
||||
isModalReady,
|
||||
}: Props & {
|
||||
isModalReady: boolean
|
||||
cancelRef?: React.RefObject<CancelRef>
|
||||
}) {
|
||||
const {currentAccount} = useSession()
|
||||
@@ -155,12 +157,6 @@ export const ComposePost = observer(function ComposePost({
|
||||
const [labels, setLabels] = useState<string[]>([])
|
||||
const [threadgate, setThreadgate] = useState<ThreadgateSetting[]>([])
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!isAndroid) return
|
||||
const id = setTimeout(() => textInput.current?.focus(), 100)
|
||||
return () => clearTimeout(id)
|
||||
}, [])
|
||||
|
||||
const gallery = useMemo(
|
||||
() => new GalleryModel(initImageUris),
|
||||
[initImageUris],
|
||||
@@ -181,9 +177,7 @@ export const ComposePost = observer(function ComposePost({
|
||||
const onPressCancel = useCallback(() => {
|
||||
if (graphemeLength > 0 || !gallery.isEmpty || extGif) {
|
||||
closeAllDialogs()
|
||||
if (Keyboard) {
|
||||
Keyboard.dismiss()
|
||||
}
|
||||
Keyboard.dismiss()
|
||||
discardPromptControl.open()
|
||||
} else {
|
||||
onClose()
|
||||
@@ -524,7 +518,11 @@ export const ComposePost = observer(function ComposePost({
|
||||
ref={textInput}
|
||||
richtext={richtext}
|
||||
placeholder={selectTextInputPlaceholder}
|
||||
autoFocus={!isAndroid}
|
||||
// fixes autofocus on android
|
||||
key={
|
||||
isAndroid ? (isModalReady ? 'ready' : 'animating') : 'static'
|
||||
}
|
||||
autoFocus={isAndroid ? isModalReady : true}
|
||||
setRichText={setRichText}
|
||||
onPhotoPasted={onPhotoPasted}
|
||||
onPressPublish={onPressPublish}
|
||||
|
||||
@@ -1,30 +1,36 @@
|
||||
import React, {useState} from 'react'
|
||||
|
||||
import {ActivityIndicator, Dimensions, StyleSheet} from 'react-native'
|
||||
import {Image} from 'expo-image'
|
||||
import {Gesture, GestureDetector} from 'react-native-gesture-handler'
|
||||
import Animated, {
|
||||
runOnJS,
|
||||
useAnimatedReaction,
|
||||
useAnimatedRef,
|
||||
useAnimatedStyle,
|
||||
useAnimatedReaction,
|
||||
useSharedValue,
|
||||
withDecay,
|
||||
withSpring,
|
||||
} from 'react-native-reanimated'
|
||||
import {GestureDetector, Gesture} from 'react-native-gesture-handler'
|
||||
import {Image} from 'expo-image'
|
||||
|
||||
import type {Dimensions as ImageDimensions, ImageSource} from '../../@types'
|
||||
import useImageDimensions from '../../hooks/useImageDimensions'
|
||||
import {
|
||||
createTransform,
|
||||
readTransform,
|
||||
applyRounding,
|
||||
createTransform,
|
||||
prependPan,
|
||||
prependPinch,
|
||||
prependTransform,
|
||||
readTransform,
|
||||
TransformMatrix,
|
||||
} from '../../transforms'
|
||||
import type {ImageSource, Dimensions as ImageDimensions} from '../../@types'
|
||||
|
||||
const SCREEN = Dimensions.get('window')
|
||||
const windowDim = Dimensions.get('window')
|
||||
const screenDim = Dimensions.get('screen')
|
||||
const statusBarHeight = windowDim.height - screenDim.height
|
||||
const SCREEN = {
|
||||
width: windowDim.width,
|
||||
height: windowDim.height + statusBarHeight,
|
||||
}
|
||||
const MIN_DOUBLE_TAP_SCALE = 2
|
||||
const MAX_ORIGINAL_IMAGE_ZOOM = 2
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import React, {useCallback, useEffect} from 'react'
|
||||
import {NativeScrollEvent} from 'react-native'
|
||||
import {interpolate, useSharedValue} from 'react-native-reanimated'
|
||||
import {
|
||||
cancelAnimation,
|
||||
interpolate,
|
||||
useSharedValue,
|
||||
} from 'react-native-reanimated'
|
||||
import EventEmitter from 'eventemitter3'
|
||||
|
||||
import {ScrollProvider} from '#/lib/ScrollContext'
|
||||
@@ -117,6 +121,8 @@ export function MainScrollProvider({children}: {children: React.ReactNode}) {
|
||||
const newValue = clamp(startMode.value + dProgress, 0, 1)
|
||||
if (newValue !== mode.value) {
|
||||
// Manually adjust the value. This won't be (and shouldn't be) animated.
|
||||
// Cancel any any existing animation
|
||||
cancelAnimation(mode)
|
||||
mode.value = newValue
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user