mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-04-28 12:24:51 +08:00
61 lines
1.0 KiB
JavaScript
61 lines
1.0 KiB
JavaScript
/**
|
|
* @flow
|
|
*/
|
|
|
|
import React from 'react';
|
|
import { any, string } from 'prop-types';
|
|
import { StyleSheet, Text, View } from 'react-native';
|
|
|
|
export const styles = StyleSheet.create({
|
|
textinput: {
|
|
height: 26,
|
|
borderWidth: 0.5,
|
|
borderColor: '#0f0f0f',
|
|
flex: 1,
|
|
padding: 4
|
|
},
|
|
eventLabel: {
|
|
margin: 3,
|
|
fontSize: 12
|
|
},
|
|
multiline: {
|
|
borderWidth: 0.5,
|
|
borderColor: '#0f0f0f',
|
|
flex: 1,
|
|
padding: 4,
|
|
marginBottom: 4
|
|
}
|
|
});
|
|
|
|
export class WithLabel extends React.Component {
|
|
static propTypes = {
|
|
children: any,
|
|
label: string
|
|
};
|
|
|
|
render() {
|
|
return (
|
|
<View style={withLabelStyles.labelContainer}>
|
|
<View style={withLabelStyles.label}>
|
|
<Text>{this.props.label}</Text>
|
|
</View>
|
|
{this.props.children}
|
|
</View>
|
|
);
|
|
}
|
|
}
|
|
|
|
const withLabelStyles = StyleSheet.create({
|
|
labelContainer: {
|
|
flexDirection: 'row',
|
|
marginVertical: 2,
|
|
flex: 1
|
|
},
|
|
label: {
|
|
width: 115,
|
|
alignItems: 'flex-end',
|
|
marginRight: 10,
|
|
paddingTop: 2
|
|
}
|
|
});
|