mirror of
https://github.com/status-im/react-native.git
synced 2025-01-15 03:56:03 +00:00
1490ab12ef
Summary: Includes React Native and its dependencies Fresco, Metro, and Yoga. Excludes samples/examples/docs. find: ^(?:( *)|( *(?:[\*~#]|::))( )? *)?Copyright (?:\(c\) )?(\d{4})\b.+Facebook[\s\S]+?BSD[\s\S]+?(?:this source tree|the same directory)\.$ replace: $1$2$3Copyright (c) $4-present, Facebook, Inc.\n$2\n$1$2$3This source code is licensed under the MIT license found in the\n$1$2$3LICENSE file in the root directory of this source tree. Reviewed By: TheSavior, yungsters Differential Revision: D7007050 fbshipit-source-id: 37dd6bf0ffec0923bfc99c260bb330683f35553e
70 lines
1.5 KiB
JavaScript
70 lines
1.5 KiB
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
* @providesModule RootViewSizeFlexibilityExampleApp
|
|
*/
|
|
'use strict';
|
|
|
|
const React = require('react');
|
|
const ReactNative = require('react-native');
|
|
const {
|
|
StyleSheet,
|
|
Text,
|
|
TouchableHighlight,
|
|
View,
|
|
} = ReactNative;
|
|
|
|
class RootViewSizeFlexibilityExampleApp extends React.Component<{toggled: boolean}, any> {
|
|
constructor(props: {toggled: boolean}) {
|
|
super(props);
|
|
this.state = { toggled: false };
|
|
}
|
|
|
|
_onPressButton() {
|
|
this.setState({ toggled: !this.state.toggled });
|
|
}
|
|
|
|
render() {
|
|
const viewStyle = this.state.toggled ? styles.bigContainer : styles.smallContainer;
|
|
|
|
return (
|
|
<TouchableHighlight onPress={this._onPressButton.bind(this)}>
|
|
<View style={viewStyle}>
|
|
<View style={styles.center}>
|
|
<Text style={styles.whiteText}>
|
|
React Native Button
|
|
</Text>
|
|
</View>
|
|
</View>
|
|
</TouchableHighlight>
|
|
);
|
|
}
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
bigContainer: {
|
|
flex: 1,
|
|
height: 60,
|
|
backgroundColor: 'gray',
|
|
},
|
|
smallContainer: {
|
|
flex: 1,
|
|
height: 40,
|
|
backgroundColor: 'gray',
|
|
},
|
|
center: {
|
|
flex: 1,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
},
|
|
whiteText: {
|
|
color: 'white',
|
|
}
|
|
});
|
|
|
|
module.exports = RootViewSizeFlexibilityExampleApp;
|