Fix some clampys
This commit is contained in:
@@ -12,7 +12,6 @@ import {ReanimatedScrollEvent} from 'react-native-reanimated/lib/typescript/hook
|
|||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
import {useSafeAreaInsets} from 'react-native-safe-area-context'
|
||||||
import {AppBskyEmbedRecord, AppBskyRichtextFacet, RichText} from '@atproto/api'
|
import {AppBskyEmbedRecord, AppBskyRichtextFacet, RichText} from '@atproto/api'
|
||||||
|
|
||||||
import {clamp} from '#/lib/numbers'
|
|
||||||
import {ScrollProvider} from '#/lib/ScrollContext'
|
import {ScrollProvider} from '#/lib/ScrollContext'
|
||||||
import {shortenLinks, stripInvalidMentions} from '#/lib/strings/rich-text-manip'
|
import {shortenLinks, stripInvalidMentions} from '#/lib/strings/rich-text-manip'
|
||||||
import {
|
import {
|
||||||
@@ -238,7 +237,7 @@ export function MessagesList({
|
|||||||
|
|
||||||
// -- Keyboard animation handling
|
// -- Keyboard animation handling
|
||||||
const {bottom: bottomInset} = useSafeAreaInsets()
|
const {bottom: bottomInset} = useSafeAreaInsets()
|
||||||
const bottomOffset = isWeb ? 0 : clamp(60 + bottomInset, 60, 75)
|
const bottomOffset = isWeb ? 0 : 60 + bottomInset
|
||||||
|
|
||||||
const keyboardHeight = useSharedValue(0)
|
const keyboardHeight = useSharedValue(0)
|
||||||
const keyboardIsOpening = useSharedValue(false)
|
const keyboardIsOpening = useSharedValue(false)
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ import {
|
|||||||
} from '#/lib/constants'
|
} from '#/lib/constants'
|
||||||
import {useAnimatedScrollHandler} from '#/lib/hooks/useAnimatedScrollHandler_FIXED'
|
import {useAnimatedScrollHandler} from '#/lib/hooks/useAnimatedScrollHandler_FIXED'
|
||||||
import {useEmail} from '#/lib/hooks/useEmail'
|
import {useEmail} from '#/lib/hooks/useEmail'
|
||||||
import {useIsKeyboardVisible} from '#/lib/hooks/useIsKeyboardVisible'
|
|
||||||
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
@@ -170,7 +169,6 @@ export const ComposePost = ({
|
|||||||
const {closeAllDialogs} = useDialogStateControlContext()
|
const {closeAllDialogs} = useDialogStateControlContext()
|
||||||
const {closeAllModals} = useModalControls()
|
const {closeAllModals} = useModalControls()
|
||||||
|
|
||||||
const [isKeyboardVisible] = useIsKeyboardVisible({iosUseWillEvents: true})
|
|
||||||
const [isPublishing, setIsPublishing] = useState(false)
|
const [isPublishing, setIsPublishing] = useState(false)
|
||||||
const [publishingStage, setPublishingStage] = useState('')
|
const [publishingStage, setPublishingStage] = useState('')
|
||||||
const [error, setError] = useState('')
|
const [error, setError] = useState('')
|
||||||
@@ -263,10 +261,9 @@ export const ComposePost = ({
|
|||||||
const viewStyles = useMemo(
|
const viewStyles = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
paddingTop: isAndroid ? insets.top : 0,
|
paddingTop: isAndroid ? insets.top : 0,
|
||||||
paddingBottom:
|
paddingBottom: 0,
|
||||||
isAndroid || (isIOS && !isKeyboardVisible) ? insets.bottom : 0,
|
|
||||||
}),
|
}),
|
||||||
[insets, isKeyboardVisible],
|
[insets],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onPressCancel = useCallback(() => {
|
const onPressCancel = useCallback(() => {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import {useMinimalShellFabTransform} from '#/lib/hooks/useMinimalShellTransform'
|
|||||||
import {useSetTitle} from '#/lib/hooks/useSetTitle'
|
import {useSetTitle} from '#/lib/hooks/useSetTitle'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
|
import {moderatePost_wrapped as moderatePost} from '#/lib/moderatePost_wrapped'
|
||||||
import {clamp} from '#/lib/numbers'
|
|
||||||
import {ScrollProvider} from '#/lib/ScrollContext'
|
import {ScrollProvider} from '#/lib/ScrollContext'
|
||||||
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
||||||
import {cleanError} from '#/lib/strings/errors'
|
import {cleanError} from '#/lib/strings/errors'
|
||||||
@@ -714,7 +713,7 @@ function MobileComposePrompt({onPressReply}: {onPressReply: () => unknown}) {
|
|||||||
styles.prompt,
|
styles.prompt,
|
||||||
fabMinimalShellTransform,
|
fabMinimalShellTransform,
|
||||||
{
|
{
|
||||||
bottom: clamp(safeAreaInsets.bottom, 13, 30),
|
bottom: safeAreaInsets.bottom,
|
||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
<PostThreadComposePrompt onPressCompose={onPressReply} />
|
<PostThreadComposePrompt onPressCompose={onPressReply} />
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {PressableScale} from '#/lib/custom-animations/PressableScale'
|
|||||||
import {useHaptics} from '#/lib/haptics'
|
import {useHaptics} from '#/lib/haptics'
|
||||||
import {useMinimalShellFabTransform} from '#/lib/hooks/useMinimalShellTransform'
|
import {useMinimalShellFabTransform} from '#/lib/hooks/useMinimalShellTransform'
|
||||||
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
|
||||||
import {clamp} from '#/lib/numbers'
|
|
||||||
import {gradients} from '#/lib/styles'
|
import {gradients} from '#/lib/styles'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {ios} from '#/alf'
|
import {ios} from '#/alf'
|
||||||
@@ -29,7 +28,7 @@ export function FABInner({testID, icon, onPress, ...props}: FABProps) {
|
|||||||
|
|
||||||
const tabletSpacing = isTablet
|
const tabletSpacing = isTablet
|
||||||
? {right: 50, bottom: 50}
|
? {right: 50, bottom: 50}
|
||||||
: {right: 24, bottom: clamp(insets.bottom, 15, 60) + 15}
|
: {right: 24, bottom: insets.bottom + 30}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Animated.View
|
<Animated.View
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {HITSLOP_20} from '#/lib/constants'
|
|||||||
import {useMinimalShellFabTransform} from '#/lib/hooks/useMinimalShellTransform'
|
import {useMinimalShellFabTransform} from '#/lib/hooks/useMinimalShellTransform'
|
||||||
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 {clamp} from '#/lib/numbers'
|
|
||||||
import {useGate} from '#/lib/statsig/statsig'
|
import {useGate} from '#/lib/statsig/statsig'
|
||||||
import {colors} from '#/lib/styles'
|
import {colors} from '#/lib/styles'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
@@ -44,9 +43,7 @@ export function LoadLatestBtn({
|
|||||||
// it on both tablet and mobile since we are showing the bottom bar (see createNativeStackNavigatorWithAuth)
|
// it on both tablet and mobile since we are showing the bottom bar (see createNativeStackNavigatorWithAuth)
|
||||||
const showBottomBar = hasSession ? isMobile : isTabletOrMobile
|
const showBottomBar = hasSession ? isMobile : isTabletOrMobile
|
||||||
|
|
||||||
const bottomPosition = isTablet
|
const bottomPosition = isTablet ? {bottom: 50} : {bottom: insets.bottom + 30}
|
||||||
? {bottom: 50}
|
|
||||||
: {bottom: clamp(insets.bottom, 15, 60) + 15}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnimatedTouchableOpacity
|
<AnimatedTouchableOpacity
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import {useDedupe} from '#/lib/hooks/useDedupe'
|
|||||||
import {useMinimalShellFooterTransform} from '#/lib/hooks/useMinimalShellTransform'
|
import {useMinimalShellFooterTransform} from '#/lib/hooks/useMinimalShellTransform'
|
||||||
import {useNavigationTabState} from '#/lib/hooks/useNavigationTabState'
|
import {useNavigationTabState} from '#/lib/hooks/useNavigationTabState'
|
||||||
import {usePalette} from '#/lib/hooks/usePalette'
|
import {usePalette} from '#/lib/hooks/usePalette'
|
||||||
import {clamp} from '#/lib/numbers'
|
|
||||||
import {getTabState, TabState} from '#/lib/routes/helpers'
|
import {getTabState, TabState} from '#/lib/routes/helpers'
|
||||||
import {useGate} from '#/lib/statsig/statsig'
|
import {useGate} from '#/lib/statsig/statsig'
|
||||||
import {s} from '#/lib/styles'
|
import {s} from '#/lib/styles'
|
||||||
@@ -125,6 +124,8 @@ export function BottomBar({navigation}: BottomTabBarProps) {
|
|||||||
accountSwitchControl.open()
|
accountSwitchControl.open()
|
||||||
}, [accountSwitchControl, playHaptic])
|
}, [accountSwitchControl, playHaptic])
|
||||||
|
|
||||||
|
console.log('BottomBar render', safeAreaInsets.bottom)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SwitchAccountDialog control={accountSwitchControl} />
|
<SwitchAccountDialog control={accountSwitchControl} />
|
||||||
@@ -134,7 +135,7 @@ export function BottomBar({navigation}: BottomTabBarProps) {
|
|||||||
styles.bottomBar,
|
styles.bottomBar,
|
||||||
pal.view,
|
pal.view,
|
||||||
pal.border,
|
pal.border,
|
||||||
{paddingBottom: clamp(safeAreaInsets.bottom, 15, 30)},
|
{paddingBottom: safeAreaInsets.bottom},
|
||||||
footerMinimalShellTransform,
|
footerMinimalShellTransform,
|
||||||
]}
|
]}
|
||||||
onLayout={e => {
|
onLayout={e => {
|
||||||
|
|||||||
Reference in New Issue
Block a user