feat(BottomSheet): add onBackdropPress handler#3074
feat(BottomSheet): add onBackdropPress handler#3074arpitBhalla merged 12 commits intoreact-native-elements:nextfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## next #3074 +/- ##
==========================================
+ Coverage 79.96% 79.97% +0.01%
==========================================
Files 88 88
Lines 1662 1663 +1
Branches 731 732 +1
==========================================
+ Hits 1329 1330 +1
Misses 328 328
Partials 5 5
Continue to review full report at Codecov.
|
khushal87
left a comment
There was a problem hiding this comment.
Please resolve merge conflicts.
src/bottomSheet/BottomSheet.tsx
Outdated
| <TouchableWithoutFeedback | ||
| onPress={onBackdropPress} | ||
| testID="RNE__Overlay__backdrop" | ||
| > | ||
| <View | ||
| testID="backdrop" | ||
| style={StyleSheet.flatten([styles.backdrop, backdropStyle])} | ||
| /> | ||
| </TouchableWithoutFeedback> | ||
|
|
TouchableWithoutFeedback to Pressable
|
|
Hope this gets added to the next release 🙏 |
flyingcircle
left a comment
There was a problem hiding this comment.
Tested this in the demo app. Did not work.
|
We need to use diff --git a/src/BottomSheet/BottomSheet.tsx b/src/BottomSheet/BottomSheet.tsx
index fb5019c3f..32edd5468 100644
--- a/src/BottomSheet/BottomSheet.tsx
+++ b/src/BottomSheet/BottomSheet.tsx
@@ -28,6 +28,8 @@ export type BottomSheetProps = {
/** Is the modal component shown. */
isVisible?: boolean;
+
+ /** Props for ScrollView */
scrollViewProps?: ScrollViewProps;
};
@@ -54,14 +56,13 @@ export const BottomSheet: RneFunctionComponent<BottomSheetProps> = ({
visible={isVisible}
{...modalProps}
>
- <Pressable onPress={onBackdropPress} testID="RNE__Overlay__backdrop">
- <View
- testID="backdrop"
- style={StyleSheet.flatten([styles.backdrop, backdropStyle])}
- />
- </Pressable>
-
+ <Pressable
+ style={[StyleSheet.absoluteFill, styles.backdrop, backdropStyle]}
+ onPress={onBackdropPress}
+ testID="RNE__Overlay__backdrop"
+ />
<SafeAreaView
+ pointerEvents={'none'}
style={StyleSheet.flatten([
styles.safeAreaView,
containerStyle && containerStyle,
~
~
~
(END) |
@arpitBhalla i have used |
|
✔️ Deploy Preview for react-native-elements canceled. 🔨 Explore the source changes: 7a5e406 🔍 Inspect the deploy log: https://app.netlify.com/sites/react-native-elements/deploys/612f867b21e9f7000872917e |
|
Thank you for your contribution 🎉 |
Co-authored-by: kedar09 <kedar@cleverground.com> Co-authored-by: Arpit Bhalla <arpitbhalla2001@gmail.com>
Co-authored-by: kedar09 <kedar@cleverground.com> Co-authored-by: Arpit Bhalla <arpitbhalla2001@gmail.com>
Co-authored-by: kedar09 <kedar@cleverground.com> Co-authored-by: Arpit Bhalla <arpitbhalla2001@gmail.com>
Co-authored-by: kedar09 <kedar@cleverground.com> Co-authored-by: Arpit Bhalla <arpitbhalla2001@gmail.com>
Co-authored-by: kedar09 <kedar@cleverground.com> Co-authored-by: Arpit Bhalla <arpitbhalla2001@gmail.com>
What kind of change does this PR introduce?
I have added the onBackdropPress function for close bottomsheet.
Did you add tests for your changes?
Yes
If relevant, did you update the documentation?
Summary
I have used react-native-elements package and I need the onBackdropPress function for bottomsheet like in overlay onBackdropPress
Does this PR introduce a breaking change?
No
Other information