2015-02-20 04:10:52 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2016-07-12 12:51:57 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2016-07-12 12:51:57 +00:00
|
|
|
*
|
2018-05-11 20:32:37 +00:00
|
|
|
* @format
|
2015-03-23 18:36:57 +00:00
|
|
|
* @flow
|
2015-02-20 04:10:52 +00:00
|
|
|
*/
|
2018-05-11 20:32:37 +00:00
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
'use strict';
|
|
|
|
|
2018-09-26 00:04:38 +00:00
|
|
|
const React = require('react');
|
|
|
|
const {StyleSheet, Text, View} = require('react-native');
|
2015-02-20 04:10:52 +00:00
|
|
|
|
2018-09-26 00:04:38 +00:00
|
|
|
type Props = $ReadOnly<{|
|
|
|
|
children?: React.Node,
|
|
|
|
title?: ?string,
|
|
|
|
description?: ?string,
|
|
|
|
|}>;
|
|
|
|
|
|
|
|
type State = {|
|
|
|
|
description: ?string,
|
|
|
|
|};
|
2015-02-20 04:10:52 +00:00
|
|
|
|
2018-09-26 00:04:38 +00:00
|
|
|
class RNTesterBlock extends React.Component<Props, State> {
|
|
|
|
state = {description: null};
|
2015-02-20 04:10:52 +00:00
|
|
|
|
2016-07-26 08:00:02 +00:00
|
|
|
render() {
|
2018-09-26 00:04:38 +00:00
|
|
|
const description = this.props.description ? (
|
|
|
|
<Text style={styles.descriptionText}>{this.props.description}</Text>
|
|
|
|
) : null;
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<View style={styles.container}>
|
|
|
|
<View style={styles.titleContainer}>
|
2018-05-11 20:32:37 +00:00
|
|
|
<Text style={styles.titleText}>{this.props.title}</Text>
|
2015-02-20 04:10:52 +00:00
|
|
|
{description}
|
|
|
|
</View>
|
2018-09-26 00:04:38 +00:00
|
|
|
<View style={styles.children}>{this.props.children}</View>
|
2015-02-20 04:10:52 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
2016-07-26 08:00:02 +00:00
|
|
|
}
|
2015-02-20 04:10:52 +00:00
|
|
|
|
2018-09-26 00:04:38 +00:00
|
|
|
const styles = StyleSheet.create({
|
2015-02-20 04:10:52 +00:00
|
|
|
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,
|
2018-05-11 20:32:37 +00:00
|
|
|
},
|
2015-02-20 04:10:52 +00:00
|
|
|
});
|
|
|
|
|
2017-05-06 03:50:47 +00:00
|
|
|
module.exports = RNTesterBlock;
|