Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(iOS,v6): support for form sheet medium detent #11516

Open
wants to merge 3 commits into
base: 6.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/native-stack/package.json
Expand Up @@ -53,7 +53,7 @@
"react": "18.2.0",
"react-native": "0.71.8",
"react-native-builder-bob": "^0.20.4",
"react-native-screens": "~3.20.0",
"react-native-screens": "~3.23.0",
"typescript": "^4.9.4"
},
"peerDependencies": {
Expand Down
66 changes: 66 additions & 0 deletions packages/native-stack/src/types.tsx
Expand Up @@ -338,6 +338,72 @@ export type NativeStackNavigationOptions = {
* @platform android
*/
navigationBarHidden?: boolean;
/**
* Describes heights where a sheet can rest.
* Works only when `stackPresentation` is set to `formSheet`.
* Defaults to `large`.
*
* Available values:
*
* - `large` - only large detent level will be allowed
* - `medium` - only medium detent level will be allowed
* - `all` - all detent levels will be allowed
*
* Requires `react-native-screens` version >=3.21.0
*
* @platform ios
*/
sheetAllowedDetents?: ScreenProps['sheetAllowedDetents'];
/**
* Whether the sheet should expand to larger detent when scrolling.
* Works only when `stackPresentation` is set to `formSheet`.
* Defaults to `true`.
*
* Requires `react-native-screens` version >=3.21.0
*
* @platform ios
*/
sheetExpandsWhenScrolledToEdge?: ScreenProps['sheetExpandsWhenScrolledToEdge'];
/**
* The corner radius that the sheet will try to render with.
* Works only when `stackPresentation` is set to `formSheet`.
*
* If set to non-negative value it will try to render sheet with provided radius, else ti will apply system default.
*
* If left unset system default is used.
*
* Requires `react-native-screens` version >=3.21.0
*
* @platform ios
*/
sheetCornerRadius?: ScreenProps['sheetCornerRadius'];
/**
* Boolean indicating whether the sheet shows a grabber at the top.
* Works only when `stackPresentation` is set to `formSheet`.
* Defaults to `false`.
*
* Requires `react-native-screens` version >=3.21.0
*
* @platform ios
*/
sheetGrabberVisible?: ScreenProps['sheetGrabberVisible'];
/**
* The largest sheet detent for which a view underneath won't be dimmed.
* Works only when `stackPresentation` is set to `formSheet`.
*
* If this prop is set to:
*
* - `large` - the view underneath won't be dimmed at any detent level
* - `medium` - the view underneath will be dimmed only when detent level is `large`
* - `all` - the view underneath will be dimmed for any detent level
*
* Defaults to `all`.
*
* Requires `react-native-screens` version >=3.21.0
*
* @platform ios
*/
sheetLargestUndimmedDetent?: ScreenProps['sheetLargestUndimmedDetent'];
/**
* Sets the status bar animation (similar to the `StatusBar` component).
* Requires setting `View controller-based status bar appearance -> YES` (or removing the config) in your `Info.plist` file.
Expand Down
10 changes: 10 additions & 0 deletions packages/native-stack/src/views/NativeStackView.native.tsx
Expand Up @@ -160,6 +160,11 @@ const SceneView = ({
statusBarStyle,
statusBarTranslucent,
statusBarColor,
sheetAllowedDetents,
sheetLargestUndimmedDetent,
sheetGrabberVisible,
sheetCornerRadius,
sheetExpandsWhenScrolledToEdge,
freezeOnBlur,
} = options;

Expand Down Expand Up @@ -275,6 +280,11 @@ const SceneView = ({
statusBarStyle={statusBarStyle}
statusBarColor={statusBarColor}
statusBarTranslucent={statusBarTranslucent}
sheetAllowedDetents={sheetAllowedDetents}
sheetLargestUndimmedDetent={sheetLargestUndimmedDetent}
sheetGrabberVisible={sheetGrabberVisible}
sheetCornerRadius={sheetCornerRadius}
sheetExpandsWhenScrolledToEdge={sheetExpandsWhenScrolledToEdge}
swipeDirection={gestureDirectionOverride}
transitionDuration={animationDuration}
onWillDisappear={onWillDisappear}
Expand Down
15 changes: 14 additions & 1 deletion yarn.lock
Expand Up @@ -5777,7 +5777,7 @@ __metadata:
react: 18.2.0
react-native: 0.71.8
react-native-builder-bob: ^0.20.4
react-native-screens: ~3.20.0
react-native-screens: ~3.23.0
typescript: ^4.9.4
warn-once: ^0.1.0
peerDependencies:
Expand Down Expand Up @@ -21982,6 +21982,19 @@ __metadata:
languageName: node
linkType: hard

"react-native-screens@npm:~3.23.0":
version: 3.23.0
resolution: "react-native-screens@npm:3.23.0"
dependencies:
react-freeze: ^1.0.0
warn-once: ^0.1.0
peerDependencies:
react: "*"
react-native: "*"
checksum: 7b61f4ab4c041cb77c3223ff334705789b6eef6c57cc9a9a6f9564788976d6a83ddea56e884e1fa4982cd5f7a92f57becb9ae4890a5fbd4183ae3ee89033d244
languageName: node
linkType: hard

"react-native-tab-view@workspace:^, react-native-tab-view@workspace:packages/react-native-tab-view":
version: 0.0.0-use.local
resolution: "react-native-tab-view@workspace:packages/react-native-tab-view"
Expand Down