Skip to content

Commit

Permalink
Merge pull request #36 from buzznog/master
Browse files Browse the repository at this point in the history
Adds 'fromBottom' animation option for modalPresentationStyle.
  • Loading branch information
Naoufal Kadhom authored Sep 1, 2016
2 parents a31c992 + 891aa59 commit 082ad5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions SafariViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ - (dispatch_queue_t)methodQueue
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"]) {
Expand All @@ -34,6 +35,11 @@ - (dispatch_queue_t)methodQueue
[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];
Expand Down
3 changes: 2 additions & 1 deletion examples/SafariViewExample/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}

Expand Down

0 comments on commit 082ad5c

Please sign in to comment.