Skip to content

Commit 0061124

Browse files
authored
Merge pull request Expensify#68610 from Eskalifer1/fix/68139
fix/68139: Add dragArea false to TestDriveBanner
2 parents bf27e9b + 9096b21 commit 0061124

3 files changed

Lines changed: 35 additions & 1 deletion

File tree

src/components/TestDrive/TestDriveBanner.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Button from '@components/Button';
44
import HeaderGap from '@components/HeaderGap';
55
import Text from '@components/Text';
66
import useLocalize from '@hooks/useLocalize';
7+
import useRefreshKeyAfterInteraction from '@hooks/useRefreshKeyAfterInteraction';
78
import useResponsiveLayout from '@hooks/useResponsiveLayout';
89
import useThemeStyles from '@hooks/useThemeStyles';
910

@@ -17,8 +18,20 @@ function TestDriveBanner({onPress}: TestDriveBannerProps) {
1718
const {shouldUseNarrowLayout} = useResponsiveLayout();
1819
const {translate} = useLocalize();
1920

21+
// Forcing a key change here forces React to fully re-mount this component
22+
// This helps reset the underlying drag region boundaries so that
23+
// interactive elements (like buttons) become clickable again after certain UI changes.
24+
// Without this, the OS-level drag region overlap clickable elements,
25+
// making them unresponsive until the container is refreshed.
26+
// For more context: https://github.com/Expensify/App/issues/68139
27+
const key = useRefreshKeyAfterInteraction('test-drive-banner');
28+
2029
return (
21-
<View style={styles.highlightBG}>
30+
<View
31+
style={[styles.highlightBG]}
32+
dataSet={{dragArea: false}}
33+
key={key}
34+
>
2235
<HeaderGap styles={styles.testDriveBannerGap} />
2336
<View style={[styles.gap2, styles.alignItemsCenter, styles.flexRow, styles.justifyContentCenter, styles.h10]}>
2437
<Text>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {useEffect, useState} from 'react';
2+
import {InteractionManager} from 'react-native';
3+
4+
function useRefreshKeyAfterInteraction(defaultValue: string) {
5+
const [counter, setCounter] = useState(0);
6+
7+
useEffect(() => {
8+
InteractionManager.runAfterInteractions(() => {
9+
setCounter((prev) => prev + 1);
10+
});
11+
}, []);
12+
13+
return `${defaultValue}-${counter}`;
14+
}
15+
16+
export default useRefreshKeyAfterInteraction;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function useRefreshKeyAfterInteraction(defaultValue: string) {
2+
return defaultValue;
3+
}
4+
5+
export default useRefreshKeyAfterInteraction;

0 commit comments

Comments
 (0)