forked from react-native-elements/react-native-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormLabel.js
More file actions
63 lines (59 loc) · 1.32 KB
/
FormLabel.js
File metadata and controls
63 lines (59 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import PropTypes from 'prop-types';
import React from 'react';
import { StyleSheet, View, Platform, Text as NativeText } from 'react-native';
import colors from '../config/colors';
import fonts from '../config/fonts';
import Text from '../text/Text';
import normalize from '../helpers/normalizeText';
import ViewPropTypes from '../config/ViewPropTypes';
const FormLabel = props => {
const {
containerStyle,
labelStyle,
children,
fontFamily,
...attributes
} = props;
return (
<View
{...attributes}
style={[styles.container, containerStyle && containerStyle]}
>
<Text
style={[
styles.label,
labelStyle && labelStyle,
fontFamily && { fontFamily },
]}
>
{children}
</Text>
</View>
);
};
FormLabel.propTypes = {
containerStyle: ViewPropTypes.style,
labelStyle: NativeText.propTypes.style,
children: PropTypes.any,
fontFamily: PropTypes.string,
};
const styles = StyleSheet.create({
container: {},
label: {
marginLeft: 20,
marginRight: 20,
marginTop: 15,
marginBottom: 1,
color: colors.grey3,
fontSize: normalize(12),
...Platform.select({
ios: {
fontWeight: 'bold',
},
android: {
...fonts.android.bold,
},
}),
},
});
export default FormLabel;