Skip to content

Commit 83e19f6

Browse files
committed
Document formSheet props and limitiations
1 parent db23292 commit 83e19f6

File tree

1 file changed

+136
-0
lines changed

1 file changed

+136
-0
lines changed

versioned_docs/version-7.x/native-stack-navigator.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,142 @@ Supported values:
869869
<source src="/assets/7.x/native-stack/presentation-formSheet.mp4" />
870870
</video>
871871

872+
:::warning
873+
874+
Due to architectural problems (lack of support of synchronous layout on UI thread by RN), `presentation: 'formSheet'` on Android has limited support for `flex: 1`. The tradeoff is necessary to prevent "sheet flickering" problem. There are also some problems with getting nested ScrollViews to work properly.
875+
876+
Currently, you should avoid using `flex: 1` on top level content container you pass to the sheet.
877+
878+
When there is less content than max screen height, you might end up with "truncated sheet" problem. The workaround is to set `backgroundColor` in the `contentStyle` prop of the given screen.
879+
:::
880+
881+
#### `sheetAllowedDetents`
882+
883+
:::note
884+
885+
Works only when `presentation` is set to `formSheet`.
886+
887+
:::
888+
889+
Describes heights where a sheet can rest.
890+
891+
Supported values:
892+
893+
- `fitToContents` - intents to set the sheet height to the height of its contents.
894+
- Array of fractions, e.g. `[0.25, 0.5, 0.75]`:
895+
- Heights should be described as fraction (a number from `[0, 1]` interval) of screen height / maximum detent height.
896+
- The array **must** be sorted in ascending order. This invariant is verified only in developement mode, where violation results in error.
897+
- iOS accepts any number of detents, while **Android is limited to three** - any surplus values, beside first three are ignored.
898+
899+
Defaults to `[1.0]`.
900+
901+
Only supported on Android and iOS.
902+
903+
#### `sheetElevation`
904+
905+
:::note
906+
907+
Works only when `presentation` is set to `formSheet`.
908+
909+
:::
910+
911+
Integer value describing elevation of the sheet, impacting shadow on the top edge of the sheet.
912+
913+
Not dynamic - changing it after the component is rendered won't have an effect.
914+
915+
Defaults to `24`.
916+
917+
Only supported on Android.
918+
919+
#### `sheetExpandsWhenScrolledToEdge`
920+
921+
:::note
922+
923+
Works only when `presentation` is set to `formSheet`.
924+
925+
:::
926+
927+
Whether the sheet should expand to larger detent when scrolling.
928+
929+
Defaults to `true`.
930+
931+
Only supported on iOS.
932+
933+
:::warning
934+
935+
Please note that for this interaction to work, the ScrollView must be "first-child-chain" descendant of the Screen component. This is a platform defined behaviour.
936+
937+
:::
938+
939+
#### `sheetCornerRadius`
940+
941+
:::note
942+
943+
Works only when `presentation` is set to `formSheet`.
944+
945+
:::
946+
947+
The corner radius that the sheet will try to render with.
948+
949+
If set to non-negative value it will try to render sheet with provided radius, else it will apply system default.
950+
951+
If left unset, system default is used.
952+
953+
Only supported on Android and iOS.
954+
955+
#### `sheetInitialDetentIndex`
956+
957+
:::note
958+
959+
Works only when `presentation` is set to `formSheet`.
960+
961+
:::
962+
963+
**Index** of the detent the sheet should expand to after being opened.
964+
965+
If the specified index is out of bounds of `sheetAllowedDetents` array, in dev environment more errors will be thrown, in production the value will be reset to default value.
966+
967+
Additionaly there is `last` value available, when set the sheet will expand initially to last (largest) detent.
968+
969+
Defaults to `0` - which represents first detent in the detents array.
970+
971+
Only supported on Android and iOS.
972+
973+
#### `sheetGrabberVisible`
974+
975+
:::note
976+
977+
Works only when `presentation` is set to `formSheet`.
978+
979+
:::
980+
981+
Boolean indicating whether the sheet shows a grabber at the top.
982+
983+
Defaults to `false`.
984+
985+
Only supported on iOS.
986+
987+
#### `sheetLargestUndimmedDetentIndex`
988+
989+
:::note
990+
991+
Works only when `presentation` is set to `formSheet`.
992+
993+
:::
994+
995+
The largest sheet detent for which a view underneath won't be dimmed.
996+
997+
This prop can be set to an number, which indicates index of detent in `sheetAllowedDetents` array for which there won't be a dimming view beneath the sheet.
998+
999+
Additionaly there are following options available:
1000+
1001+
- `none` - there will be dimming view for all detents levels,
1002+
- `last` - there won't be a dimming view for any detent level.
1003+
1004+
Defaults to `none`, indicating that the dimming view should be always present.
1005+
1006+
Only supported on Android and iOS.
1007+
8721008
#### `orientation`
8731009

8741010
The display orientation to use for the screen.

0 commit comments

Comments
 (0)