-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChainApplyFunctions.js
More file actions
52 lines (43 loc) · 1.13 KB
/
ChainApplyFunctions.js
File metadata and controls
52 lines (43 loc) · 1.13 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
import React, { Component } from 'react'
import { styles } from './styles'
import { Theme, Text, View, withStyles, chain } from 'react-native-themeable'
const redTheme = withStyles([
{
$type: Text,
color: 'white',
fontSize: 16,
}, {
$type: View,
backgroundColor: 'red',
padding: 20,
},
])
const blueTheme = withStyles([
{
$type: View,
backgroundColor: 'blue',
margin: 10,
},
])
export default class ChainApplyFunctions extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.description}>
You can chain/combine multiple apply functions using `chain`.
It is useful when you need to inherit styles from other themes.
</Text>
<Theme apply={redTheme}>
<View>
<Text>Using red theme with white text</Text>
<Theme apply={chain(blueTheme, redTheme)} inherit={true}>
<View>
<Text>Using both blue and red theme (I've inherited text styles)</Text>
</View>
</Theme>
</View>
</Theme>
</View>
)
}
}