Skip to content

Commit 0b942ba

Browse files
authored
Merge pull request #331 from valtech-sd/develop
iOS: Add formSheetPreferredContentSize prop to allow for custom sized formSheet modals
2 parents 62d59a8 + 727f5fc commit 0b942ba

File tree

6 files changed

+21
-2
lines changed

6 files changed

+21
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ in case of vulnerabilities.
2222

2323
## [Unreleased]
2424

25+
## [3.7.0] - 2022-03-01
26+
27+
### Added
28+
- iOS: Add formSheetPreferredContentSize prop to allow for custom sized formSheet modals by [@ShaneMckenna23](https://github.com/ShaneMckenna23) ([#331](https://github.com/proyecto26/react-native-inappbrowser/pull/331)).
29+
2530
## [3.6.3] - 2021-07-05
2631

2732
### Fixed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ Property | Description
159159
`modalEnabled` (Boolean) | Present the **SafariViewController** modally or as push instead. [`true`/`false`]
160160
`enableBarCollapsing` (Boolean) | Determines whether the browser's tool bars will collapse or not. [`true`/`false`]
161161
`ephemeralWebSession` (Boolean) | Prevent re-use cookies of previous session (openAuth only) [`true`/`false`]
162+
`formSheetPreferredContentSize` (Object) | Custom size for iPad `formSheet` modals [`{width: 400, height: 500}`]
162163
163164
### Android Options
164165
Property | Description

index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ declare module 'react-native-inappbrowser-reborn' {
3636
| 'partialCurl',
3737
modalEnabled?: boolean,
3838
enableBarCollapsing?: boolean,
39-
ephemeralWebSession?: boolean
39+
ephemeralWebSession?: boolean,
40+
formSheetPreferredContentSize?: { width: number, height: number },
4041
}
4142

4243
export type InAppBrowserAndroidOptions = {

ios/RNInAppBrowser.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ + (BOOL)requiresMainQueueSetup
148148
NSNumber* preferredControlTintColor = [options valueForKey:@"preferredControlTintColor"];
149149
NSString* modalPresentationStyle = [options valueForKey:@"modalPresentationStyle"];
150150
NSString* modalTransitionStyle = [options valueForKey:@"modalTransitionStyle"];
151+
NSDictionary* formSheetPreferredContentSize = [options valueForKey:@"formSheetPreferredContentSize"];
151152

152153
BOOL readerMode = [options[@"readerMode"] boolValue];
153154
BOOL enableBarCollapsing = [options[@"enableBarCollapsing"] boolValue];
@@ -207,6 +208,16 @@ + (BOOL)requiresMainQueueSetup
207208
if(animated) {
208209
safariHackVC.modalTransitionStyle = [self getTransitionStyle: modalTransitionStyle];
209210
}
211+
212+
if([modalPresentationStyle isEqualToString:@"formSheet"] && formSheetPreferredContentSize){
213+
NSNumber *width = [formSheetPreferredContentSize valueForKey:@"width"];
214+
NSNumber *height = [formSheetPreferredContentSize valueForKey:@"height"];
215+
216+
if(width && height){
217+
safariHackVC.preferredContentSize = CGSizeMake([width doubleValue], [height doubleValue]);
218+
}
219+
}
220+
210221
safariHackVC.presentationController.delegate = self;
211222
#pragma clang diagnostic push
212223
#pragma clang diagnostic ignored "-Wpartial-availability"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-inappbrowser-reborn",
3-
"version": "3.6.3",
3+
"version": "3.7.0",
44
"description": "InAppBrowser for React Native",
55
"main": "index.js",
66
"scripts": {

types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export type InAppBrowseriOSOptions = {|
4141
modalEnabled?: boolean,
4242
enableBarCollapsing?: boolean,
4343
ephemeralWebSession?: boolean,
44+
formSheetPreferredContentSize?: { width: number, height: number },
4445
|};
4546

4647
export type InAppBrowserAndroidOptions = {|

0 commit comments

Comments
 (0)