-
-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
232 additions
and
154 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
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
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
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,48 @@ | ||
diff --git a/node_modules/react-native-gesture-handler/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt b/node_modules/react-native-gesture-handler/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt | ||
index 51be37c..cb507d4 100644 | ||
--- a/node_modules/react-native-gesture-handler/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt | ||
+++ b/node_modules/react-native-gesture-handler/android/lib/src/main/java/com/swmansion/gesturehandler/GestureHandlerOrchestrator.kt | ||
@@ -5,6 +5,7 @@ import android.graphics.PointF | ||
import android.view.MotionEvent | ||
import android.view.View | ||
import android.view.ViewGroup | ||
+import com.swmansion.gesturehandler.react.RNGestureHandlerRootHelper | ||
import java.util.* | ||
|
||
class GestureHandlerOrchestrator( | ||
@@ -546,12 +547,19 @@ class GestureHandlerOrchestrator( | ||
// in began state | ||
return false | ||
} | ||
- return if (handler !== other && | ||
+ | ||
+ if (handler !== other && | ||
(handler.isAwaiting || handler.state == GestureHandler.STATE_ACTIVE)) { | ||
// in every other case as long as the handler is about to be activated or already in active | ||
// state, we delegate the decision to the implementation of GestureHandler#shouldBeCancelledBy | ||
- handler.shouldBeCancelledBy(other) | ||
- } else true | ||
+ return handler.shouldBeCancelledBy(other) | ||
+ } | ||
+ | ||
+ if (other is RNGestureHandlerRootHelper.RootViewGestureHandler && handler is PanGestureHandler) { | ||
+ return false; | ||
+ } | ||
+ | ||
+ return true | ||
} | ||
|
||
private fun isFinished(state: Int) = | ||
diff --git a/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt b/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt | ||
index 8c20453..dcf54dd 100644 | ||
--- a/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt | ||
+++ b/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerRootHelper.kt | ||
@@ -53,7 +53,7 @@ class RNGestureHandlerRootHelper(private val context: ReactContext, wrappedView: | ||
} | ||
} | ||
|
||
- private inner class RootViewGestureHandler : GestureHandler<RootViewGestureHandler>() { | ||
+ inner class RootViewGestureHandler : GestureHandler<RootViewGestureHandler>() { | ||
override fun onHandle(event: MotionEvent) { | ||
val currentState = state | ||
if (currentState == STATE_UNDETERMINED) { |
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
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,47 @@ | ||
import React from 'react'; | ||
import { View, StyleSheet, Platform } from 'react-native'; | ||
import { useNavigation } from '@react-navigation/native'; | ||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; | ||
import Button from '../../components/button'; | ||
import withModalProvider from '../withModalProvider'; | ||
import BackdropExample from '../modal/BackdropExample'; | ||
|
||
const RootScreen = () => { | ||
const { navigate } = useNavigation(); | ||
return ( | ||
<View style={styles.container}> | ||
<Button | ||
label="Navigate to Native Modal" | ||
// @ts-ignore | ||
onPress={() => navigate('NativeModal')} | ||
/> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
padding: 24, | ||
}, | ||
}); | ||
|
||
const NativeStack = createNativeStackNavigator(); | ||
|
||
export default withModalProvider(() => ( | ||
<NativeStack.Navigator> | ||
<NativeStack.Screen | ||
name="Root" | ||
component={RootScreen} | ||
options={{ headerShown: false }} | ||
/> | ||
<NativeStack.Screen | ||
name="NativeModal" | ||
component={BackdropExample} | ||
options={{ | ||
presentation: 'modal', | ||
headerShown: Platform.OS === 'ios', | ||
}} | ||
/> | ||
</NativeStack.Navigator> | ||
)); |
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
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
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
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 |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import React, { FC } from 'react'; | ||
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet'; | ||
|
||
const withModalProvider = (Component: FC) => () => { | ||
return ( | ||
const withModalProvider = (Component: FC) => () => | ||
( | ||
<BottomSheetModalProvider> | ||
<Component /> | ||
</BottomSheetModalProvider> | ||
); | ||
}; | ||
|
||
export default withModalProvider; |
Oops, something went wrong.