From 7e5d4335ca90e01227f87bf40e7282f262a1d0bd Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Sun, 24 Sep 2017 22:57:33 -0700 Subject: [PATCH] SafeAreaViewExample inside RNTester Reviewed By: mmmulani Differential Revision: D5888672 fbshipit-source-id: 3de827cbbbb71c9d4bfcc8a1830eea962e707bbe --- RNTester/js/RNTesterList.ios.js | 5 ++ RNTester/js/SafeAreaViewExample.js | 88 ++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 RNTester/js/SafeAreaViewExample.js diff --git a/RNTester/js/RNTesterList.ios.js b/RNTester/js/RNTesterList.ios.js index b34531308..63a43716a 100644 --- a/RNTester/js/RNTesterList.ios.js +++ b/RNTester/js/RNTesterList.ios.js @@ -123,6 +123,11 @@ const ComponentExamples: Array = [ module: require('./RefreshControlExample'), supportsTVOS: false, }, + { + key: 'SafeAreaViewExample', + module: require('./SafeAreaViewExample'), + supportsTVOS: true, + }, { key: 'ScrollViewExample', module: require('./ScrollViewExample'), diff --git a/RNTester/js/SafeAreaViewExample.js b/RNTester/js/SafeAreaViewExample.js new file mode 100644 index 000000000..6f06e0925 --- /dev/null +++ b/RNTester/js/SafeAreaViewExample.js @@ -0,0 +1,88 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @format + * @providesModule SafeAreaViewExample + */ +'use strict'; + +var React = require('react'); +var ReactNative = require('react-native'); +var {Button, Modal, SafeAreaView, StyleSheet, View} = ReactNative; + +exports.displayName = (undefined: ?string); +exports.framework = 'React'; +exports.title = ''; +exports.description = + 'SafeAreaView automatically applies paddings reflect the portion of the view that is not covered by other (special) ancestor views.'; + +class SafeAreaViewExample extends React.Component< + {}, + {|modalVisible: boolean|}, +> { + state = { + modalVisible: false, + }; + + _setModalVisible = visible => { + this.setState({modalVisible: visible}); + }; + + render() { + return ( + + this._setModalVisible(false)} + animationType="slide" + supportedOrientations={['portrait', 'landscape']}> + + + +