2015-02-19 20:10:52 -08:00
|
|
|
/**
|
2018-09-11 15:27:47 -07:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2016-07-12 05:51:57 -07:00
|
|
|
*
|
2018-02-16 18:24:55 -08: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 05:51:57 -07:00
|
|
|
*
|
2018-05-11 13:32:37 -07:00
|
|
|
* @format
|
2015-03-23 11:36:57 -07:00
|
|
|
* @flow
|
2015-02-19 20:10:52 -08:00
|
|
|
*/
|
2018-05-11 13:32:37 -07:00
|
|
|
|
2015-02-19 20:10:52 -08:00
|
|
|
'use strict';
|
|
|
|
|
2018-09-25 17:04:38 -07:00
|
|
|
const React = require('react');
|
|
|
|
const {StyleSheet, Text, View} = require('react-native');
|
2015-02-19 20:10:52 -08:00
|
|
|
|
2018-09-25 17:04:38 -07:00
|
|
|
type Props = $ReadOnly<{|
|
|
|
|
children?: React.Node,
|
|
|
|
title?: ?string,
|
|
|
|
description?: ?string,
|
|
|
|
|}>;
|
|
|
|
|
|
|
|
type State = {|
|
|
|
|
description: ?string,
|
|
|
|
|};
|
2015-02-19 20:10:52 -08:00
|
|
|
|
2018-09-25 17:04:38 -07:00
|
|
|
class RNTesterBlock extends React.Component<Props, State> {
|
|
|
|
state = {description: null};
|
2015-02-19 20:10:52 -08:00
|
|
|
|
2016-07-26 01:00:02 -07:00
|
|
|
render() {
|
2018-09-25 17:04:38 -07:00
|
|
|
const description = this.props.description ? (
|
|
|
|
<Text style={styles.descriptionText}>{this.props.description}</Text>
|
|
|
|
) : null;
|
2015-02-19 20:10:52 -08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<View style={styles.container}>
|
|
|
|
<View style={styles.titleContainer}>
|
2018-05-11 13:32:37 -07:00
|
|
|
<Text style={styles.titleText}>{this.props.title}</Text>
|
2015-02-19 20:10:52 -08:00
|
|
|
{description}
|
|
|
|
</View>
|
2018-09-25 17:04:38 -07:00
|
|
|
<View style={styles.children}>{this.props.children}</View>
|
2015-02-19 20:10:52 -08:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
2016-07-26 01:00:02 -07:00
|
|
|
}
|
2015-02-19 20:10:52 -08:00
|
|
|
|
2018-09-25 17:04:38 -07:00
|
|
|
const styles = StyleSheet.create({
|
2015-02-19 20:10:52 -08:00
|
|
|
container: {
|
|
|
|
borderRadius: 3,
|
|
|
|
borderWidth: 0.5,
|
|
|
|
borderColor: '#d6d7da',
|
|
|
|
backgroundColor: '#ffffff',
|
|
|
|
margin: 10,
|
|
|
|
marginVertical: 5,
|
|
|
|
overflow: 'hidden',
|
|
|
|
},
|
|
|
|
titleContainer: {
|
2015-05-13 08:22:21 -07:00
|
|
|
borderBottomWidth: 0.5,
|
|
|
|
borderTopLeftRadius: 3,
|
|
|
|
borderTopRightRadius: 2.5,
|
|
|
|
borderBottomColor: '#d6d7da',
|
2015-02-19 20:10:52 -08:00
|
|
|
backgroundColor: '#f6f7f8',
|
|
|
|
paddingHorizontal: 10,
|
|
|
|
paddingVertical: 5,
|
|
|
|
},
|
|
|
|
titleText: {
|
|
|
|
fontSize: 14,
|
2015-03-25 16:22:59 -07:00
|
|
|
fontWeight: '500',
|
2015-02-19 20:10:52 -08:00
|
|
|
},
|
|
|
|
descriptionText: {
|
|
|
|
fontSize: 14,
|
|
|
|
},
|
|
|
|
children: {
|
2015-05-28 09:29:27 -07:00
|
|
|
margin: 10,
|
2018-05-11 13:32:37 -07:00
|
|
|
},
|
2015-02-19 20:10:52 -08:00
|
|
|
});
|
|
|
|
|
2017-05-05 20:50:47 -07:00
|
|
|
module.exports = RNTesterBlock;
|