From d0327342783f5357f22fbc6b3903b51843306930 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Tue, 4 Jun 2024 12:55:35 +0300 Subject: [PATCH] Composer - make bottom border more consistent when typing (#4343) * floor values * fix last line being obscured * Rm unnecessary runOnUI --------- Co-authored-by: Dan Abramov --- src/view/com/composer/Composer.tsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx index 93cc87fc82..b78dafc917 100644 --- a/src/view/com/composer/Composer.tsx +++ b/src/view/com/composer/Composer.tsx @@ -20,7 +20,6 @@ import { } from 'react-native-keyboard-controller' import Animated, { interpolateColor, - runOnUI, useAnimatedStyle, useSharedValue, withTiming, @@ -396,7 +395,7 @@ export const ComposePost = observer(function ComposePost({ testID="composePostView" behavior="padding" style={a.flex_1} - keyboardVerticalOffset={replyTo ? 110 : isAndroid ? 180 : 140}> + keyboardVerticalOffset={replyTo ? 115 : isAndroid ? 180 : 162}> = scrollViewHeight.value + contentHeight.value - contentOffset.value - 5 > scrollViewHeight.value ? 1 : 0, ) @@ -667,9 +666,8 @@ function useAnimatedBorders() { const scrollHandler = useAnimatedScrollHandler({ onScroll: event => { + 'worklet' hasScrolledTop.value = withTiming(event.contentOffset.y > 0 ? 1 : 0) - - // already on UI thread showHideBottomBorder({ newContentOffset: event.contentOffset.y, newContentHeight: event.contentSize.height, @@ -680,7 +678,8 @@ function useAnimatedBorders() { const onScrollViewContentSizeChange = useCallback( (_width: number, height: number) => { - runOnUI(showHideBottomBorder)({ + 'worklet' + showHideBottomBorder({ newContentHeight: height, }) }, @@ -689,7 +688,8 @@ function useAnimatedBorders() { const onScrollViewLayout = useCallback( (evt: LayoutChangeEvent) => { - runOnUI(showHideBottomBorder)({ + 'worklet' + showHideBottomBorder({ newScrollViewHeight: evt.nativeEvent.layout.height, }) },