diff --git a/packages/rn-tester/js/examples/Modal/ModalExample.js b/packages/rn-tester/js/examples/Modal/ModalExample.js index 9d8b07e63d8757..fec5a88bb54908 100644 --- a/packages/rn-tester/js/examples/Modal/ModalExample.js +++ b/packages/rn-tester/js/examples/Modal/ModalExample.js @@ -21,6 +21,7 @@ const { Text, TouchableHighlight, View, + ScrollView, } = require('react-native'); const Item = Picker.Item; @@ -78,9 +79,12 @@ class ModalExample extends React.Component<{...}, $FlowFixMeState> { animationType: 'none', modalVisible: false, transparent: false, + hardwareAccelerated: false, + statusBarTranslucent: false, presentationStyle: 'fullScreen', selectedSupportedOrientation: '0', currentOrientation: 'unknown', + action: '', }; _setModalVisible = visible => { @@ -95,10 +99,39 @@ class ModalExample extends React.Component<{...}, $FlowFixMeState> { this.setState({transparent: !this.state.transparent}); }; + _toggleHardwareAccelerated = () => { + this.setState({hardwareAccelerated: !this.state.hardwareAccelerated}); + }; + + _toggleStatusBarTranslucent = () => { + this.setState({statusBarTranslucent: !this.state.statusBarTranslucent}); + }; + renderSwitch() { if (Platform.isTV) { return null; } + if (Platform.OS === 'android') { + return ( + <> + Hardware Accelerated + + Status Bar Translucent + + Transparent + + + ); + } return ( { }; return ( - + this._setModalVisible(false)} supportedOrientations={ @@ -135,7 +170,13 @@ class ModalExample extends React.Component<{...}, $FlowFixMeState> { } onOrientationChange={evt => this.setState({currentOrientation: evt.nativeEvent.orientation}) - }> + } + onDismiss={() => { + if (this.state.action === 'onDismiss') alert(this.state.action); + }} + onShow={() => { + if (this.state.action === 'onShow') alert(this.state.action); + }}> @@ -181,15 +222,12 @@ class ModalExample extends React.Component<{...}, $FlowFixMeState> { - - Transparent - {this.renderSwitch()} - + {this.renderSwitch()} {this.renderPickers()} - + ); } renderPickers() { @@ -219,7 +257,7 @@ class ModalExample extends React.Component<{...}, $FlowFixMeState> { - this.setState({selectedSupportedOrientation: i}) + this.setState({selectedSupportedOrientation: i.toString()}) } itemStyle={styles.pickerItem}> @@ -230,6 +268,28 @@ class ModalExample extends React.Component<{...}, $FlowFixMeState> { + + + Actions + {Platform.OS === 'ios' ? ( + this.setState({action})} + itemStyle={styles.pickerItem}> + + + + + ) : ( + this.setState({action})} + itemStyle={styles.pickerItem}> + + + + )} + ); } @@ -282,4 +342,8 @@ const styles = StyleSheet.create({ pickerItem: { fontSize: 16, }, + ScrollView: { + paddingTop: 10, + paddingBottom: 100, + }, });