Skip to content

Commit 2c33975

Browse files
committed
fix/68139: Add dragArea false to TestDriveBanner
1 parent 4d29406 commit 2c33975

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

src/components/TestDrive/TestDriveBanner.tsx

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import React from 'react';
2-
import {View} from 'react-native';
1+
import React, {useEffect, useState} from 'react';
2+
import {InteractionManager, View} from 'react-native';
33
import Button from '@components/Button';
44
import HeaderGap from '@components/HeaderGap';
55
import Text from '@components/Text';
66
import useLocalize from '@hooks/useLocalize';
77
import useResponsiveLayout from '@hooks/useResponsiveLayout';
88
import useThemeStyles from '@hooks/useThemeStyles';
9+
import getPlatform from '@libs/getPlatform';
10+
import CONST from '@src/CONST';
911

1012
type TestDriveBannerProps = {
1113
/** Callback to finish the test drive */
@@ -16,9 +18,32 @@ function TestDriveBanner({onPress}: TestDriveBannerProps) {
1618
const styles = useThemeStyles();
1719
const {shouldUseNarrowLayout} = useResponsiveLayout();
1820
const {translate} = useLocalize();
21+
const [refreshKey, setRefreshKey] = useState(0);
22+
23+
// Forcing a key change here forces React to fully re-mount this component
24+
// This helps reset the underlying drag region boundaries so that
25+
// interactive elements (like buttons) become clickable again after certain UI changes.
26+
// Without this, the OS-level drag region overlap clickable elements,
27+
// making them unresponsive until the container is refreshed.
28+
// For more context: https://github.com/Expensify/App/issues/68139
29+
useEffect(() => {
30+
const isDesktop = getPlatform() === CONST.PLATFORM.DESKTOP;
31+
32+
if (!isDesktop) {
33+
return;
34+
}
35+
36+
InteractionManager.runAfterInteractions(() => {
37+
setRefreshKey((prev) => prev + 1);
38+
});
39+
}, []);
1940

2041
return (
21-
<View style={styles.highlightBG}>
42+
<View
43+
style={[styles.highlightBG]}
44+
dataSet={{dragArea: false}}
45+
key={refreshKey}
46+
>
2247
<HeaderGap styles={styles.testDriveBannerGap} />
2348
<View style={[styles.gap2, styles.alignItemsCenter, styles.flexRow, styles.justifyContentCenter, styles.h10]}>
2449
<Text>

0 commit comments

Comments
 (0)