Merge pull request #36 from buzznog/master

Adds 'fromBottom' animation option for modalPresentationStyle.
This commit is contained in:
Naoufal Kadhom
2016-09-01 16:14:27 -04:00
committed by GitHub
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
});
}