ViewPagerAndroid不显示孩子

时间:2017-12-01 00:19:31

标签: react-native react-native-android

我直接从这里的文档中复制过来:

        <View style={styles.container}>
            <Text style={styles.welcome}>
                Welcome to React Native!
            </Text>
            <Text style={styles.instructions}>
                To get started, edit App.js
            </Text>
            <Text style={styles.instructions}>
                {instructions}
            </Text>
            <View style={styles.main}>
                <ViewPagerAndroid style={styles.viewPager} initialPage={0}>
                    <View style={styles.pageStyle}>
                        <Text>First page</Text>
                    </View>
                    <View style={styles.pageStyle}>
                        <Text>Second page</Text>
                    </View>
                </ViewPagerAndroid>
            </View>
        </View>

我的样式表:

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#F5FCFF',
    },
    welcome: {
        fontSize: 20,
        textAlign: 'center',
        margin: 10,
    },
    instructions: {
        textAlign: 'center',
        color: '#333333',
        marginBottom: 5,
    },
    main: {
        backgroundColor: 'pink',
        height: 300
    },
    viewPager: {
        height: 100,
        backgroundColor: 'skyblue'
    },
    pageStyle: {
        padding: 20,
        width: 100,
        height: 100,
        backgroundColor: 'green',
        flex: 1
    }
});

全部是pinkskyblue矩形。我不知道孩子为什么不渲染。有没有人有任何想法?

0 个答案:

没有答案
相关问题