Skip to content

Commit 5eceb36

Browse files
fix: [ScreenFooter] - Fix taps absorbed in footer area on Android (physical devices)
Made-with: Cursor
1 parent 44ba28d commit 5eceb36

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

  • packages/react-native-ui-lib/src/components/screenFooter

packages/react-native-ui-lib/src/components/screenFooter/index.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ const ScreenFooter = (props: ScreenFooterProps) => {
226226

227227
const childrenArray = React.Children.toArray(children).slice(0, 3).map(renderChild);
228228

229+
// Touch fall-through fix:
230+
// `pointerEvents` on a Reanimated Animated.View is unreliable on Android
231+
// (https://github.com/software-mansion/react-native-reanimated/issues/8497,
232+
// https://github.com/software-mansion/react-native-gesture-handler/issues/1270),
233+
// which makes taps in the footer's transparent area absorbed instead of falling
234+
// through to content behind. When the footer is statically visible (no entrance
235+
// animation needed) we skip Animated.View and render a plain RN View tree, which
236+
// honours pointerEvents on Android.
237+
const isStaticVisible = animationDuration === 0 && visible;
238+
229239
const renderFooterContent = useCallback(() => {
230240
return (
231241
<>
@@ -238,6 +248,21 @@ const ScreenFooter = (props: ScreenFooterProps) => {
238248
}, [renderBackground, testID, contentContainerStyle, childrenArray]);
239249

240250
if (keyboardBehavior === KeyboardBehavior.HOISTED) {
251+
if (isStaticVisible) {
252+
return (
253+
<View pointerEvents="box-none" style={styles.container}>
254+
<Keyboard.KeyboardAccessoryView
255+
renderContent={renderFooterContent}
256+
kbInputRef={undefined}
257+
scrollBehavior={Keyboard.KeyboardAccessoryView.scrollBehaviors.FIXED_OFFSET}
258+
useSafeArea={false}
259+
manageScrollView={false}
260+
revealKeyboardInteractive
261+
onHeightChanged={setHeight}
262+
/>
263+
</View>
264+
);
265+
}
241266
return (
242267
<Animated.View style={[styles.container, hoistedAnimatedStyle]} pointerEvents={visible ? 'box-none' : 'none'}>
243268
<Keyboard.KeyboardAccessoryView
@@ -253,6 +278,14 @@ const ScreenFooter = (props: ScreenFooterProps) => {
253278
);
254279
}
255280

281+
if (isStaticVisible) {
282+
return (
283+
<View testID={testID} onLayout={onLayout} pointerEvents="box-none" style={styles.container}>
284+
{renderFooterContent()}
285+
</View>
286+
);
287+
}
288+
256289
return (
257290
<Animated.View testID={testID} onLayout={onLayout} style={[styles.container, stickyAnimatedStyle]}>
258291
{renderFooterContent()}

0 commit comments

Comments
 (0)