From 25511785aad4c5611ef18e8c84927a91bc63bf8b Mon Sep 17 00:00:00 2001 From: Graham Mendick Date: Fri, 1 Dec 2023 17:46:00 +0000 Subject: [PATCH] Sketched in non-modal section and code --- documentation/native/bottom-sheet.html | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/documentation/native/bottom-sheet.html b/documentation/native/bottom-sheet.html index c6ec74c5e..4837857c5 100644 --- a/documentation/native/bottom-sheet.html +++ b/documentation/native/bottom-sheet.html @@ -52,19 +52,26 @@

Web

Bottom Sheet

- You use the BottomSheet component to avoid cluttering up the main content. The sheet starts off collapsed and the user expands it by dragging. The BottomSheet is 100% native so it must be a child of a CoordinatorLayout on Android. In our example application, when the user opens an email we display the sender's information in a BottomSheet. The peekHeight determines how much of the sender the user sees to start with. We turn on nested scrolling so that expanding the sheet seamlessly scrolls the sender. + You use the BottomSheet component to avoid cluttering up the main content. The sheet starts off collapsed and the user expands it by dragging. In our example application, when the user opens an email we display the sender's information in a BottomSheet. The peekHeight determines how much of the sender the user sees to start with. We turn on nested scrolling so that expanding the sheet seamlessly scrolls the sender.

import {BottomSheet} from 'navigation-react-native';
 
-<CoordinatorLayout>
-  <BottomSheet peekHeight={200}>
-    <ScrollView nestedScrollEnabled={true} />
-  </BottomSheet>
-</CoordinatorLayout>
+<BottomSheet modal={true} peekHeight={200}> + <ScrollView nestedScrollEnabled={true} /> +</BottomSheet>

Note

On iOS, the animation isn't completely smooth. Removing the stutter when dragging the sheet quickly will have to wait until React Native introduces synchronous view resizing.
+

Non-modal Bottom Sheet (Android)

+

+ The BottomSheet is 100% native so it must be a child of a CoordinatorLayout on Android. +

+
<CoordinatorLayout>
+  <BottomSheet modal={false}>
+    <ScrollView nestedScrollEnabled={true} />
+  </BottomSheet>
+</CoordinatorLayout>

Controlling the Bottom Sheet

The resting states of a BottomSheet are called detents, for example, 'collapsed' or 'expanded'. By default the BottomSheet is uncontrolled, where only the user can change the detent (by dragging). But it can also be controlled so you can programmatically change the detent. In our email example, when the user presses the sender's icon button we expand the BottomSheet to reveal the sender's details.