-
-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: touch event canceled with gesture disabled (#1032)
Adds event cancelation only when gesture should be recognized.
- Loading branch information
Showing
2 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import * as React from 'react'; | ||
import {Alert, Button, Switch, Text, View} from 'react-native'; | ||
import {NavigationContainer, ParamListBase} from '@react-navigation/native'; | ||
import { | ||
createNativeStackNavigator, | ||
NativeStackNavigationProp, | ||
} from 'react-native-screens/native-stack'; | ||
|
||
const Stack = createNativeStackNavigator(); | ||
|
||
export default function App() { | ||
const [gestureEnabled, setGestureEnable] = React.useState(false); | ||
return ( | ||
<View style={{flex: 1, paddingBottom: 200}}> | ||
<NavigationContainer> | ||
<Stack.Navigator screenOptions={{gestureEnabled}}> | ||
<Stack.Screen name="Top" component={First} /> | ||
<Stack.Screen name="Top1" component={Second} /> | ||
</Stack.Navigator> | ||
</NavigationContainer> | ||
<View> | ||
<Text>Gesture enabled</Text> | ||
<Switch value={gestureEnabled} onValueChange={setGestureEnable} /> | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
function First({ | ||
navigation, | ||
}: { | ||
navigation: NativeStackNavigationProp<ParamListBase>; | ||
}) { | ||
return ( | ||
<View style={{backgroundColor: '#FFF'}}> | ||
<Button | ||
title="Tap me for second screen" | ||
onPress={() => navigation.push('Top1')} | ||
/> | ||
</View> | ||
); | ||
} | ||
|
||
function Second() { | ||
return ( | ||
<View style={{backgroundColor: '#FFF'}}> | ||
<Button title="Swipe back to see if button click triggers" onPress={() => Alert.alert('Click detected')} /> | ||
</View> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters