Skip to content

Commit e529c1c

Browse files
IOS: Add custom size option to formSheet Modal
1 parent 7322e18 commit e529c1c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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* formSheetContentSize = [options valueForKey:@"formSheetContentSize"];
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"] && formSheetContentSize){
213+
NSNumber *width = [formSheetContentSize valueForKey:@"width"];
214+
NSNumber *height = [formSheetContentSize 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"

0 commit comments

Comments
 (0)