Skip to content

Commit 5c8faca

Browse files
authored
chore: update @gorhom/bottom-sheet to v5 (#1126)
## 📜 Description Fixed a crash in `KeyboardAwareScrollView` example app after #1120 ## 💡 Motivation and Context `@gorhom/bottom-sheet@4` is not compatible with reanimated v4. So in this PR I updated lib to v5 to fix an instant crash after opening a screen that uses `@gorhom/bottom-sheet` library. ## 📢 Changelog <!-- High level overview of important changes --> <!-- For example: fixed status bar manipulation; added new types declarations; --> <!-- If your changes don't affect one of platform/language below - then remove this platform/language --> ### JS - update `@gorhom/portal` lib to v5; ## 🤔 How Has This Been Tested? Tested manually in FabricExample in `KeyboardAwareScrollView` example screen (both iOS/Android). ## 📸 Screenshots (if appropriate): <img width="251" height="519" alt="image" src="https://github.com/user-attachments/assets/1639b865-a7cc-44cf-b845-d05558469ac5" /> ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
1 parent 8b21604 commit 5c8faca

File tree

3 files changed

+43
-41
lines changed

3 files changed

+43
-41
lines changed

FabricExample/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"postinstall": "patch-package"
1111
},
1212
"dependencies": {
13-
"@gorhom/bottom-sheet": "4.6.4",
13+
"@gorhom/bottom-sheet": "5.2.6",
1414
"@react-native-community/blur": "^4.4.1",
1515
"@react-native-masked-view/masked-view": "^0.3.2",
1616
"@react-navigation/bottom-tabs": "^6.6.1",

FabricExample/src/screens/Examples/AwareScrollView/index.tsx

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import BottomSheet from "@gorhom/bottom-sheet";
1+
import BottomSheet, { BottomSheetView } from "@gorhom/bottom-sheet";
22
import React, { useCallback, useEffect, useRef, useState } from "react";
33
import { Button, Platform, Switch, Text, View } from "react-native";
44
import { KeyboardAwareScrollView } from "react-native-keyboard-controller";
@@ -106,42 +106,44 @@ export default function AwareScrollView({ navigation }: Props) {
106106
/>
107107
</KeyboardAwareScrollView>
108108
<BottomSheet ref={bottomSheetModalRef} index={-1} snapPoints={["40%"]}>
109-
<Button
110-
testID="bottom_sheet_close_modal"
111-
title="Close modal"
112-
onPress={() => bottomSheetModalRef.current?.close()}
113-
/>
114-
<View style={styles.switchContainer}>
115-
<Text>Toggle back scroll</Text>
116-
<Switch
117-
testID="bottom_sheet_toggle_back_scroll"
118-
value={disableScrollOnKeyboardHide}
119-
onChange={() => {
120-
setDisableScrollOnKeyboardHide(!disableScrollOnKeyboardHide);
121-
}}
122-
/>
123-
</View>
124-
<View style={styles.switchContainer}>
125-
<Text>Toggle enabled</Text>
126-
<Switch
127-
testID="bottom_sheet_toggle_enabled_state"
128-
value={enabled}
129-
onChange={() => {
130-
setEnabled(!enabled);
131-
}}
132-
/>
133-
</View>
134-
135-
<View style={styles.switchContainer}>
136-
<Text>Toggle snapToOffsets</Text>
137-
<Switch
138-
testID="bottom_sheet_toggle_snap_to_offsets"
139-
value={snapToOffsetsEnabled}
140-
onChange={() => {
141-
setSnapToOffsetsEnabled(!snapToOffsetsEnabled);
142-
}}
109+
<BottomSheetView style={styles.bottomSheetContent}>
110+
<Button
111+
testID="bottom_sheet_close_modal"
112+
title="Close modal"
113+
onPress={() => bottomSheetModalRef.current?.close()}
143114
/>
144-
</View>
115+
<View style={styles.switchContainer}>
116+
<Text>Toggle back scroll</Text>
117+
<Switch
118+
testID="bottom_sheet_toggle_back_scroll"
119+
value={disableScrollOnKeyboardHide}
120+
onChange={() => {
121+
setDisableScrollOnKeyboardHide(!disableScrollOnKeyboardHide);
122+
}}
123+
/>
124+
</View>
125+
<View style={styles.switchContainer}>
126+
<Text>Toggle enabled</Text>
127+
<Switch
128+
testID="bottom_sheet_toggle_enabled_state"
129+
value={enabled}
130+
onChange={() => {
131+
setEnabled(!enabled);
132+
}}
133+
/>
134+
</View>
135+
136+
<View style={styles.switchContainer}>
137+
<Text>Toggle snapToOffsets</Text>
138+
<Switch
139+
testID="bottom_sheet_toggle_snap_to_offsets"
140+
value={snapToOffsetsEnabled}
141+
onChange={() => {
142+
setSnapToOffsetsEnabled(!snapToOffsetsEnabled);
143+
}}
144+
/>
145+
</View>
146+
</BottomSheetView>
145147
</BottomSheet>
146148
</>
147149
);

FabricExample/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,10 +1042,10 @@
10421042
dependencies:
10431043
"@types/hammerjs" "^2.0.36"
10441044

1045-
"@gorhom/bottom-sheet@4.6.4":
1046-
version "4.6.4"
1047-
resolved "https://registry.yarnpkg.com/@gorhom/bottom-sheet/-/bottom-sheet-4.6.4.tgz#387d0f0f21e3470eb8575498cb81ce96f5108e79"
1048-
integrity sha512-0itLMblLBvepE065w3a60S030c2rNUsGshPC7wbWDm31VyqoaU2xjzh/ojH62YIJOcobBr5QoC30IxBBKDGovQ==
1045+
"@gorhom/bottom-sheet@5.2.6":
1046+
version "5.2.6"
1047+
resolved "https://registry.yarnpkg.com/@gorhom/bottom-sheet/-/bottom-sheet-5.2.6.tgz#5f2045f6ca965383afe39f7dfa3afad1502b7467"
1048+
integrity sha512-vmruJxdiUGDg+ZYcDmS30XDhq/h/+QkINOI5LY/uGjx8cPGwgJW0H6AB902gNTKtccbiKe/rr94EwdmIEz+LAQ==
10491049
dependencies:
10501050
"@gorhom/portal" "1.0.14"
10511051
invariant "^2.2.4"

0 commit comments

Comments
 (0)