-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add BottomSheetV2 #42201
feat: Add BottomSheetV2 #42201
Conversation
Size Change: -2.13 kB (0%) Total Size: 1.52 MB
ℹ️ View Unchanged
|
style={ { paddingLeft: 0, paddingRight: 0 } } | ||
style={ { marginBottom: bottomInset + 20 } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing BottomSheet
includes bottom offset to account for safe area and horizontal padding. I am undecided as to whether this should reside in the BottomSheetV2
abstraction. There are times where the horizontal padding is overridden in certain contexts. Should this be managed by the BottomSheet
or the individual context controlled by the child? E.g. PanelBody
provides its own padding equaling the padding provided by BottomSheet
.
const { | ||
animatedHandleHeight, | ||
animatedSnapPoints, | ||
animatedContentHeight, | ||
handleContentLayout, | ||
} = useBottomSheetDynamicSnapPoints( snapPoints ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may make more sense to expect a consumer of BottomSheetV2
to control and pass these props to BottomSheetV2
. It would likely be a bit verbose, but might offer more flexibility and a simpler BottomSheetV2
.
ref={ ref } | ||
snapPoints={ animatedSnapPoints } | ||
> | ||
<BottomSheetScrollView onLayout={ handleContentLayout }> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current BottomSheet
includes a dynamic content container element. It defaults to a ScrollView
, but allows switching to a View
if the child has navigation. This component will likely need a similar feature long-term.
useImperativeHandle( ref, () => ( { | ||
present: handlePresent, | ||
dismiss: handleDismiss, | ||
} ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was originally added while exploring usage for the Editor Help bottom sheet. This code is unused at this point and might should be removed, but was left in place for discussion of an imperative API mirroring the @gorhom/bottom-sheet
library.
<GestureHandlerRootView | ||
style={ styles[ 'bottom-sheet-v2__gesture-handler' ] } | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Android modals require a separate GestureHandlerRootView
to have dismiss on swipe or backdrop press operate correctly.
}, [ onClose ] ); | ||
|
||
return ( | ||
<Modal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modal
is used rather than @gorhom/bottom-sheet
's BottomSheetModal
as the latter is incapable of rendering atop the WP host app header navigation. If the header navigation is ever managed by React Native, then we may be able to switch modal providers and simplify our implementation here.
Sass files ultimately use the StyleSheet API, which is better performance than inline objects.
Remove unnecessary padding removal, ensure proper bottom margin.
Support for backdrop tap and swipe down dimissal requires additional `react-native-gesture-handler` integration. Additionally, Android modal specifically need a special HoC provided by the library.
The dependency absence was oversight.
e9150d2
to
a13fd7b
Compare
Update - Sep 11 2023The failing CI tests appear to be a fairly low-level issue related to This PR targets the Heading level menu via the Support for a However, the aforementioned |
Related PRs
What?
Adds
BottomSheetV2
as a potential replacement for the existingBottomSheet
to address #37559. UpdatesDropdownMenu
to utilizeBottomSheetV2
.Why?
Relates to #42192. As detailed in #37559, the current
BottomSheet
suffers from a number performance and quality issues.How?
The proposed
BottomSheetV2
utilizes@gorhom/bottom-sheet
to benefit from the attention to detail placed on features like performance, dynamic height, gestures, etc.Remaining Work
Testing Instructions
Perform the following for the heading level/alignment selection bottom sheets on various devices and orientations.
Screenshots or screencast
Android Screenshots
iOS Screenshots
iOS Interactions
RPReplay_Final1657139083.MP4