2015-02-20 04:10:52 +00:00
|
|
|
/**
|
2015-03-28 05:18:47 +00:00
|
|
|
* The examples provided by Facebook are for non-commercial testing and
|
|
|
|
* evaluation purposes only.
|
2015-03-23 20:35:08 +00:00
|
|
|
*
|
2015-03-28 05:18:47 +00:00
|
|
|
* Facebook reserves all rights not expressly granted.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
|
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2015-02-20 04:10:52 +00:00
|
|
|
*
|
|
|
|
* @providesModule UIExplorerBlock
|
2015-03-23 18:36:57 +00:00
|
|
|
* @flow
|
2015-02-20 04:10:52 +00:00
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
2016-04-08 04:13:12 +00:00
|
|
|
var React = require('react');
|
|
|
|
var ReactNative = require('react-native');
|
2015-02-20 04:10:52 +00:00
|
|
|
var {
|
|
|
|
StyleSheet,
|
|
|
|
Text,
|
|
|
|
View,
|
2016-04-08 04:13:12 +00:00
|
|
|
} = ReactNative;
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
var UIExplorerBlock = React.createClass({
|
|
|
|
propTypes: {
|
|
|
|
title: React.PropTypes.string,
|
|
|
|
description: React.PropTypes.string,
|
|
|
|
},
|
|
|
|
|
|
|
|
getInitialState: function() {
|
2015-03-23 18:36:57 +00:00
|
|
|
return {description: (null: ?string)};
|
2015-02-20 04:10:52 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
var description;
|
|
|
|
if (this.props.description) {
|
|
|
|
description =
|
|
|
|
<Text style={styles.descriptionText}>
|
|
|
|
{this.props.description}
|
|
|
|
</Text>;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style={styles.container}>
|
|
|
|
<View style={styles.titleContainer}>
|
|
|
|
<Text style={styles.titleText}>
|
|
|
|
{this.props.title}
|
|
|
|
</Text>
|
|
|
|
{description}
|
|
|
|
</View>
|
|
|
|
<View style={styles.children}>
|
|
|
|
{this.props.children}
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
borderRadius: 3,
|
|
|
|
borderWidth: 0.5,
|
|
|
|
borderColor: '#d6d7da',
|
|
|
|
backgroundColor: '#ffffff',
|
|
|
|
margin: 10,
|
|
|
|
marginVertical: 5,
|
|
|
|
overflow: 'hidden',
|
|
|
|
},
|
|
|
|
titleContainer: {
|
2015-05-13 15:22:21 +00:00
|
|
|
borderBottomWidth: 0.5,
|
|
|
|
borderTopLeftRadius: 3,
|
|
|
|
borderTopRightRadius: 2.5,
|
|
|
|
borderBottomColor: '#d6d7da',
|
2015-02-20 04:10:52 +00:00
|
|
|
backgroundColor: '#f6f7f8',
|
|
|
|
paddingHorizontal: 10,
|
|
|
|
paddingVertical: 5,
|
|
|
|
},
|
|
|
|
titleText: {
|
|
|
|
fontSize: 14,
|
2015-03-25 23:22:59 +00:00
|
|
|
fontWeight: '500',
|
2015-02-20 04:10:52 +00:00
|
|
|
},
|
|
|
|
descriptionText: {
|
|
|
|
fontSize: 14,
|
|
|
|
},
|
|
|
|
disclosure: {
|
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
|
|
|
right: 0,
|
|
|
|
padding: 10,
|
|
|
|
},
|
|
|
|
disclosureIcon: {
|
|
|
|
width: 12,
|
|
|
|
height: 8,
|
|
|
|
},
|
|
|
|
children: {
|
2015-05-28 16:29:27 +00:00
|
|
|
margin: 10,
|
2015-02-20 04:10:52 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = UIExplorerBlock;
|