Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: add new presentationStyle options #1515

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

**Features**

- Added new `presentationStyle` options for CustomerSheet and AddressSheet. [#1515](https://github.com/stripe/stripe-react-native/pull/1515)

## 0.33.0 - 2023-09-22

**Features**
Expand Down
8 changes: 8 additions & 0 deletions ios/AddressSheet/AddressSheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ class AddressSheetView: UIView {
switch (presentationStyle) {
case "fullscreen":
return .fullScreen
case "pageSheet":
return .pageSheet
case "formSheet":
return .formSheet
case "automatic":
return .automatic
case "overFullScreen":
return .overFullScreen
case "popover":
fallthrough
default:
Expand Down
8 changes: 8 additions & 0 deletions ios/CustomerSheet/CustomerSheetUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ class CustomerSheetUtils {
switch (string) {
case "fullscreen":
return .fullScreen
case "pageSheet":
return .pageSheet
case "formSheet":
return .formSheet
case "automatic":
return .automatic
case "overFullScreen":
return .overFullScreen
case "popover":
fallthrough
default:
Expand Down
10 changes: 8 additions & 2 deletions src/components/AddressSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ const AddressSheetNative = requireNativeComponent<any>('AddressSheetView');
export interface Props extends AccessibilityProps {
/** Whether the sheet is visible. Defaults to false. */
visible: boolean;
/** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. */
presentationStyle?: 'fullscreen' | 'popover';
/** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle for more info. */
presentationStyle?:
| 'fullscreen'
| 'popover'
| 'pageSheet'
| 'formSheet'
| 'automatic'
| 'overFullScreen';
/** Controls how the modal animates. iOS only. */
animationStyle?: 'flip' | 'curl' | 'slide' | 'dissolve';
/** Configuration for the look and feel of the UI. */
Expand Down
10 changes: 8 additions & 2 deletions src/types/CustomerSheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@ export type CustomerSheetInitParams = {
};

export type CustomerSheetPresentParams = {
/** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. */
presentationStyle?: 'fullscreen' | 'popover';
/** Controls how the modal is presented (after animation). iOS only. Defaults to `popover`. See https://developer.apple.com/documentation/uikit/uimodalpresentationstyle for more info. */
presentationStyle?:
| 'fullscreen'
| 'popover'
| 'pageSheet'
| 'formSheet'
| 'automatic'
| 'overFullScreen';
/** Controls how the modal animates. iOS only. */
animationStyle?: 'flip' | 'curl' | 'slide' | 'dissolve';
/** Time (in milliseconds) before the Customer Sheet will automatically dismiss. */
Expand Down