mirror of
https://github.com/tappollo/react-native-safari-view.git
synced 2026-01-12 17:03:09 +08:00
Adds 'fromBottom' option for modalPresentationStyle.
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user