question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bottom sheet only opens sometimes

See original GitHub issue

Bug

Using with Expo 40, and just repro’d with the latest "@gorhom/bottom-sheet": "^2.0.2" on a real Android device using the Expo app.

I can’t nail down what’s causing this, but the bottom sheet will only open sometimes (see console output screenshot below). On load it’s open correctly, but if I swipe down to close it, then it only opens seemingly randomly when the onPress={openPostActions} is pressed.

image

Method

const postActions = useRef<BottomSheet>(null);
const openPostActions = () => {
	console.log('openPostActions()');
	postActions.current.snapTo(1);
};

Bottom sheet

<BottomSheet
	ref={postActions}
	index={1}
	snapPoints={[0, '25%']}
	onChange={handleSheetChanges}
>
	<View style={styles.contentContainer}>
		<Text onPress={reportPost} style={styles.postActionsText}>Report Post</Text>
		<View style={{ backgroundColor: 'black', borderTop: 1, opacity: .15, height: 1,}} />
		<Text onPress={deletePost} style={[styles.postActionsText, styles.postActionsTextDanger]}>Delete Post</Text>
	</View>
</BottomSheet>

Environment info

Library Version
@gorhom/bottom-sheet 2.0.2
react-native https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz
react-native-reanimated 2.0.0-rc.1
react-native-gesture-handler 1.9.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
theianjohnsoncommented, Jan 11, 2021

I may’ve found something, I downgraded to your v2 and Reanimated 1 and I can repro this. Without useMemo it won’t open, even though in your documentation you have an example of not using it, which is what I was doing

https://gorhom.github.io/react-native-bottom-sheet/props

ie.

Does not work

snapPoints={[0, '25%']}

Does work

const snapPoints = useMemo(() => [0, '25%'], []);
// ...
snapPoints={snapPoints}
0reactions
gorhomcommented, Jan 11, 2021

good finding , i think it is important to provide a memoized variables to prevent unwanted side effects, i will need to update the docs to mention it 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set state of BottomSheetDialogFragment to expanded
Bottom sheets are set to STATE_COLLAPSED at first. Call BottomSheetBehavior#setState(STATE_EXPANDED) if you want to expand it. Note that you ...
Read more >
Fitted Bottom Sheet Only | Wayfair
Open Box Price:$33.30-$35.81. (680). Rated 4.5 out of 5 stars.680 total votes. Free shipping. This sheet set makes your bed a cool, soft...
Read more >
The 6 Best Fitted Sheets of 2022 | Tested by GearLab
We tested dozens of fitted sheets from brands like Cosmoplus, Amazon Basics, Mayfair, and more to find the softest, coziest, most durable options...
Read more >
Jetpack Compose — Android Bottom Sheet | by Christian Halim
In Jetpack Compose, there are two types of bottom sheets, BottomSheet ... With these classes, it will simplify our bottom sheet because we...
Read more >
We Slept on Lots of Linen Sheets, and These Are Our 19 ...
“The sheets feel nice, soft, and cozy and have washed just fine,” she adds. The queen set comes with a fitted sheet and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found