forked from react-native-elements/react-native-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathText.js
More file actions
47 lines (43 loc) · 955 Bytes
/
Text.js
File metadata and controls
47 lines (43 loc) · 955 Bytes
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
import React from 'react'
import { Text, StyleSheet, Platform } from 'react-native'
import fonts from '../config/fonts'
let styles = {}
const TextElement = ({style, children, h1, h2, h3, h4, h5, h6, fontFamily}) => (
<Text
style={[
styles.text,
h1 && {fontSize: 40},
h2 && {fontSize: 34},
h3 && {fontSize: 28},
h4 && {fontSize: 22},
h1 && styles.bold,
h2 && styles.bold,
h3 && styles.bold,
h4 && styles.bold,
fontFamily && {fontFamily},
style && style
]}>{children}</Text>
)
styles = StyleSheet.create({
text: {
...Platform.select({
ios: {
fontFamily: fonts.ios.regular
},
android: {
fontFamily: fonts.android.regular
}
})
},
bold: {
...Platform.select({
ios: {
fontFamily: fonts.ios.bold
},
android: {
fontFamily: fonts.android.bold
}
})
}
})
export default TextElement