Fix automatic footer compensation in Layout.Content (#10526)

This commit is contained in:
Samuel Newman
2026-05-18 12:57:06 +01:00
committed by GitHub
parent 45597de6e0
commit e58a09e0ca
+9 -10
View File
@@ -7,7 +7,7 @@ import {
} from 'react-native' } from 'react-native'
import Animated, { import Animated, {
type AnimatedScrollViewProps, type AnimatedScrollViewProps,
useAnimatedProps, useAnimatedStyle,
} from 'react-native-reanimated' } from 'react-native-reanimated'
import {useSafeAreaInsets} from 'react-native-safe-area-context' import {useSafeAreaInsets} from 'react-native-safe-area-context'
@@ -88,14 +88,14 @@ export const Content = memo(
const t = useTheme() const t = useTheme()
const {footerHeight} = useShellLayout() const {footerHeight} = useShellLayout()
const {isWithinSplitView} = useIsWithinSplitView() const {isWithinSplitView} = useIsWithinSplitView()
const animatedProps = useAnimatedProps(() => {
// note - if we ever make the footer transparent in any way,
// we'll need to change this to use contentInsets/scrollIndicatorInsets
// on iOS and contentContainerStyle padding on Android -sfn
const animatedStyle = useAnimatedStyle(() => {
return { return {
scrollIndicatorInsets: { marginBottom: footerHeight.get(),
bottom: footerHeight.get(), }
top: 0,
right: 1,
},
} satisfies AnimatedScrollViewProps
}) })
return ( return (
@@ -104,10 +104,9 @@ export const Content = memo(
id="content" id="content"
automaticallyAdjustsScrollIndicatorInsets={false} automaticallyAdjustsScrollIndicatorInsets={false}
indicatorStyle={t.scheme === 'dark' ? 'white' : 'black'} indicatorStyle={t.scheme === 'dark' ? 'white' : 'black'}
// sets the scroll inset to the height of the footer
animatedProps={animatedProps}
style={[ style={[
a.w_full, a.w_full,
animatedStyle,
isWithinSplitView && isWithinSplitView &&
web({ web({
flex: 1, flex: 1,