2015-02-20 04:10:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* @providesModule UIExplorerPage
|
2015-03-23 18:36:57 +00:00
|
|
|
* @flow
|
2015-02-20 04:10:52 +00:00
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var React = require('react-native');
|
|
|
|
var {
|
|
|
|
ScrollView,
|
|
|
|
StyleSheet,
|
|
|
|
View,
|
|
|
|
} = React;
|
|
|
|
|
|
|
|
var UIExplorerTitle = require('./UIExplorerTitle');
|
|
|
|
|
|
|
|
var UIExplorerPage = React.createClass({
|
|
|
|
|
|
|
|
propTypes: {
|
|
|
|
keyboardShouldPersistTaps: React.PropTypes.bool,
|
|
|
|
noScroll: React.PropTypes.bool,
|
|
|
|
noSpacer: React.PropTypes.bool,
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
var ContentWrapper;
|
|
|
|
var wrapperProps = {};
|
|
|
|
if (this.props.noScroll) {
|
|
|
|
ContentWrapper = View;
|
|
|
|
} else {
|
|
|
|
ContentWrapper = ScrollView;
|
|
|
|
wrapperProps.keyboardShouldPeristTaps = true;
|
2015-03-03 18:22:29 +00:00
|
|
|
wrapperProps.keyboardDismissMode = 'interactive';
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
var title = this.props.title ?
|
|
|
|
<UIExplorerTitle title={this.props.title} /> :
|
|
|
|
null;
|
|
|
|
var spacer = this.props.noSpacer ? null : <View style={styles.spacer} />;
|
|
|
|
return (
|
|
|
|
<View style={styles.container}>
|
|
|
|
{title}
|
|
|
|
<ContentWrapper
|
|
|
|
style={styles.wrapper}
|
|
|
|
{...wrapperProps}>
|
|
|
|
{this.props.children}
|
|
|
|
{spacer}
|
|
|
|
</ContentWrapper>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
var styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
backgroundColor: '#e9eaed',
|
|
|
|
paddingTop: 15,
|
|
|
|
flex: 1,
|
|
|
|
},
|
|
|
|
spacer: {
|
|
|
|
height: 270,
|
|
|
|
},
|
|
|
|
wrapper: {
|
|
|
|
flex: 1,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = UIExplorerPage;
|