BottomSheet v4 released with Reanimated v2 rewrite
BottomSheet v4 has been released, with a rewritten implementation that its author says aims to provide more stability, performance and features. The library now fully uses Reanimated v2 hooks and variables instead of JS ones, which the author says allows more customization and improves stability overall.
New features
- Keyboard handling: First introduced in v3, keyboard handling is now enabled by default and offers more customization options. A new prop,
android_keyboardInputMode, handles the Android keyboard appearance configwindowSoftInputMode. - Pull to refresh: One of the earliest feature requests on the repo, this was previously blocked by limitations in v2 and v3. It is enabled by default; users provide
refreshingandonRefreshto any of the Scrollables. - Detach Sheet / Modal:
BottomSheetandBottomSheetModalcan now be detached from the bottom of the screen, allowing more options for positioning the sheet. - Footer Component: A new
footerComponentprop onBottomSheetandBottomSheetModallets users stick a custom component to the bottom of the sheet, even when the keyboard is shown.
Breaking changes
Removed props:
animationEasingandanimationDurationfromBottomSheetcloseOnPressfromBottomSheetBackdropdismissOnClosefromBottomSheetModalenableFlashScrollableIndicatorOnExpandfromBottomSheet
Other changes: snapPoints no longer accepts 0 as a value, and the default value of animateOnMount is now true.
Changelog highlights
Refactors include a single generic scrollable component, conversion of all internal state and memoized variables to Reanimated shared values, and updated handling of animated heights.
Additions include enable pan down to close, snap to position, a pre-integrated VirtualizedList component, an onClose callback, backgroundStyle, handleStyle and handleIndicatorStyle props, and a forceClose method on BottomSheet.
Fixes cover sheet positioning on modals, preventing animatedPosition from becoming undefined, an on-mount flicker on fixed sheets, keyboard height in container calculation, re-snapping to the current position when snap points are updated, and handling of an initially closed sheet.
The author thanks contributors and testers, as well as Software Mansion for Reanimated and Gesture Handler, which power the library.
Links
Source: gorhom.dev