未设置React本机状态栏背景颜色

时间:2016-04-21 07:42:46

标签: react-native statusbar

我试图在renderSectionHeader函数中设置状态栏导航backgroundcolor:

renderSectionHeader() {
    return (
        <View>
            <StatusBar
              backgroundColor="purple"
              barStyle="light-content"
            />
            <View style={styles.header}>
                <Text style={styles.headerTitle}>Company</Text>
            </View>
        </View>
    )
}

首先,它似乎不是设置StatusBar属性的正确位置。虽然barStyle属性有效,但未设置backgroundColor。它是透明的&amp;实际问题是ListView滚动状态栏后面。在this SO问题中,建议使用UINavigationController。但我无法找到有效的实施方案。

初始Status bar initial Scolled Status bar scrolled

1 个答案:

答案 0 :(得分:1)

backgroundColor属性仅限android,请参阅http://facebook.github.io/react-native/releases/0.26/docs/statusbar.html#backgroundcolor

也许尝试使用状态栏的高度在列表视图中添加margin top属性。