Explanation of Modal's purpose in hybrid apps

Summary: Explained that Modal is for hybrid apps and suggest using a top-level Navigator in pure RN apps.
Closes https://github.com/facebook/react-native/pull/2663

Reviewed By: @​svcscm

Differential Revision: D2483626

Pulled By: @sahrens
This commit is contained in:
James Ide 2015-09-27 23:46:00 -07:00 committed by facebook-github-bot-5
parent 4978855d72
commit 92109b8a0c
1 changed files with 12 additions and 0 deletions

View File

@ -19,6 +19,18 @@ var View = require('View');
var requireNativeComponent = require('requireNativeComponent'); var requireNativeComponent = require('requireNativeComponent');
var RCTModalHostView = requireNativeComponent('RCTModalHostView', null); var RCTModalHostView = requireNativeComponent('RCTModalHostView', null);
/**
* A Modal component covers the native view (e.g. UIViewController, Activity)
* that contains the React Native root.
*
* Use Modal in hybrid apps that embed React Native; Modal allows the portion of
* your app written in React Native to present content above the enclosing
* native view hierarchy.
*
* In apps written with React Native from the root view down, you should use
* Navigator instead of Modal. With a top-level Navigator, you have more control
* over how to present the modal scene over the rest of your app.
*/
class Modal extends React.Component { class Modal extends React.Component {
render(): ?ReactElement { render(): ?ReactElement {
if (this.props.visible === false) { if (this.props.visible === false) {