/** * Copyright (c) 2013-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. * * @providesModule KeyboardAvoidingViewExample */ 'use strict'; const React = require('React'); const ReactNative = require('react-native'); const { KeyboardAvoidingView, Modal, SegmentedControlIOS, StyleSheet, Text, TextInput, TouchableHighlight, View, } = ReactNative; const UIExplorerBlock = require('./UIExplorerBlock'); const UIExplorerPage = require('./UIExplorerPage'); const KeyboardAvoidingViewExample = React.createClass({ statics: { title: '', description: 'Base component for views that automatically adjust their height or position to move out of the way of the keyboard.', }, getInitialState() { return { behavior: 'padding', modalOpen: false, }; }, onSegmentChange(segment: String) { this.setState({behavior: segment.toLowerCase()}); }, renderExample() { return ( this.setState({modalOpen: false})} style={styles.closeButton}> Close this.setState({modalOpen: true})}> Open Example ); }, render() { return ( {this.renderExample()} ); }, }); const styles = StyleSheet.create({ outerContainer: { flex: 1, }, container: { flex: 1, justifyContent: 'center', paddingHorizontal: 20, paddingTop: 20, }, textInput: { borderRadius: 5, borderWidth: 1, height: 44, paddingHorizontal: 10, }, segment: { marginBottom: 10, }, closeButton: { position: 'absolute', top: 30, left: 10, } }); module.exports = KeyboardAvoidingViewExample;