Make 'onRequestClose' a required prop for Modal on Android. Fixes #6612

Summary:The `onRequestClose` prop can be used to handle dismissing the modal by back button. It's pretty easy to miss the `onRequestClose` prop on Android. So making it a required prop makes sure that it generates a warning when not supplied.

Context #6612
Closes https://github.com/facebook/react-native/pull/6667

Differential Revision: D3102054

Pulled By: javache

fb-gh-sync-id: 878240606285d231b5592a438918e441765bfe5f
fbshipit-source-id: 878240606285d231b5592a438918e441765bfe5f
This commit is contained in:
Satyajit Sahoo 2016-03-26 10:23:41 -07:00 committed by Facebook Github Bot 3
parent d0f6a1a13e
commit ce81f8b35a

View File

@ -11,6 +11,7 @@
*/
'use strict';
var Platform = require('Platform');
var PropTypes = require('ReactPropTypes');
var React = require('React');
var StyleSheet = require('StyleSheet');
@ -61,7 +62,7 @@ Modal.propTypes = {
animated: PropTypes.bool,
transparent: PropTypes.bool,
visible: PropTypes.bool,
onRequestClose: PropTypes.func,
onRequestClose: Platform.OS === 'android' ? PropTypes.func.isRequired : PropTypes.func,
onShow: PropTypes.func,
};