Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Safari view not being presentable from a modal #53

Merged
merged 2 commits into from
Oct 1, 2017

Conversation

Amwam
Copy link
Contributor

@Amwam Amwam commented Jan 20, 2017

This is a fix for #26
The SafariView cannot be presented when a Modal is shown, as we try to present the SafariViewController on top of a view controller that is not visible.

This change cycles through any presented view controllers, and attempts to present on top of the foremost controller

Here is a minimal react-native application that presents this problem without the change, and is subsequently fixed with the change.
I have also tested the situation without the modal (simply by commenting out the <Modal> lines in this example)

import React, { Component } from 'react';
import {
  AppRegistry,
  View,
  Modal, 
  Button,
} from 'react-native';
import SafariView from 'react-native-safari-view'

export default class safaritest extends Component {
  render() {
    return (
        <View>
            <Modal>
                <Button title="Press me" onPress={()=> {
                    SafariView.isAvailable().then(()=> {
                        SafariView.show({url: 'http://github.com'})
                    })
                }} />
            </Modal>
        </View>
       );
  }
}


AppRegistry.registerComponent('safaritest', () => safaritest);

@Amwam Amwam force-pushed the bugfix/modal-presentation branch from 0326acf to 01658cc Compare January 20, 2017 21:27
nfcampos added a commit to nfcampos/react-native-safari that referenced this pull request Apr 16, 2017
@Amwam
Copy link
Contributor Author

Amwam commented Jul 13, 2017

@naoufal Any chance we can get some progress on this, or one of the other modal related PRs? (they all seem to have a similar solution)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants