-
Notifications
You must be signed in to change notification settings - Fork 22
/
7-stretch-enabled.js
53 lines (48 loc) · 1.41 KB
/
7-stretch-enabled.js
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
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Block, Grid, Section } from 'react-native-responsive-layout';
const styles = StyleSheet.create({
flexibleContainer: {
flex: 1,
},
text: {
textAlign: 'center',
color: '#02326b',
fontSize: 40,
lineHeight: 80,
},
});
export default () => (
<Grid stretchable>
{/* This ensures grid itself spans available space. */}
<Section>
<Block>
<View style={{ height: 80, backgroundColor: '#d4e7fe' }}>
<Text style={styles.text}>Header</Text>
</View>
</Block>
</Section>
<Section stretch>
{/* By default Sections are not stretched. */}
<Block size="1/4">
<View style={[{ backgroundColor: '#b2d4fe' }, styles.flexibleContainer]}>
{/* When nesting elements inside stretched section blocks, if you want
them to fill space do not forget to add flex: 1 */}
<Text style={styles.text}>L</Text>
</View>
</Block>
<Block size="stretch">
<View style={[{ backgroundColor: '#91c2fd' }, styles.flexibleContainer]}>
<Text style={styles.text}>Content</Text>
</View>
</Block>
</Section>
<Section>
<Block>
<View style={{ height: 80, backgroundColor: '#6faffd' }}>
<Text style={styles.text}>Footer</Text>
</View>
</Block>
</Section>
</Grid>
);