Adds 'fromBottom' option for modalPresentationStyle.

This commit is contained in:
Zachary Gibson
2016-09-01 14:10:34 -05:00
parent a31c9923dc
commit 891aa59795
2 changed files with 8 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ RCT_EXPORT_MODULE()
RCT_EXPORT_METHOD(show:(NSDictionary *)args callback:(RCTResponseSenderBlock)callback)
{
UIColor *tintColorString = args[@"tintColor"];
BOOL fromBottom = [args[@"fromBottom"] boolValue];
// Error if no url is passed
if (!args[@"url"]) {
@@ -34,6 +35,11 @@ RCT_EXPORT_METHOD(show:(NSDictionary *)args callback:(RCTResponseSenderBlock)cal
[self.safariView.view setTintColor:tintColor];
}
// Set modal transition style
if(fromBottom) {
self.safariView.modalPresentationStyle = UIModalPresentationOverFullScreen;
}
// Display the Safari View
UIViewController *ctrl = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
[ctrl presentViewController:self.safariView animated:YES completion:nil];

View File

@@ -65,7 +65,8 @@ class SafariViewExample extends Component {
SafariView.show({
url: 'http://twitter.com/naoufal',
readerMode: true,
tintColor: "rgb(0, 0, 0)"
tintColor: "rgb(0, 0, 0)",
fromBottom: true
});
}