From ce81f8b35af8d273072583d369594d4f5fd6d696 Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Sat, 26 Mar 2016 10:23:41 -0700 Subject: [PATCH] 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 --- Libraries/Modal/Modal.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libraries/Modal/Modal.js b/Libraries/Modal/Modal.js index 7f31a9f65..9a0873dd5 100644 --- a/Libraries/Modal/Modal.js +++ b/Libraries/Modal/Modal.js @@ -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, };