当达到某个应用程序的某个部分时,可以如何更改StatusBar backgroundColor属性?React Native - 在达到某个区域时更改StatusBar颜色
例如:我有一个视图(部分),默认backgroundColor是红色,当向下滚动到该部分我想将StatusBar backgroundColor更改为蓝色。
这里就是我想要做的组件(注:我使用的是天然碱基):
<Container>
<StatusBar backgroundColor='#2c3e50' barStyle='dark-content' />
<Content>
<Grid>
<Col>
<Row>
<Text>
App title name
</Text>
</Row>
</Col>
<Row>
<Col>
<Text>
Random description
</Text>
</Col>
</Row>
<Col>
<Row>
<Text>
</Text>
</Row>
</Col>
<Row>
<Col style={{padding: 20, backgroundColor: '#2980b9'}}>
<Text style={{color: 'white', textAlign: 'justify'}}>
Random text
</Text>
<Text style={{ color: 'white', paddingTop: 10, textAlign: 'justify'}}>
More random text
</Text>
</Col>
</Row>
<Row>
<Col style={{backgroundColor: '#1abc9c'}}>
<Text style={{color: 'white', fontSize: 40, textAlign: 'center'}}>
Chocolate
</Text>
</Col>
</Row>
<Row>
<Col>
<Text>
Random txt
</Text>
</Col>
</Row>
</Grid>
</Content>
</Container>
发布你做了什么,而不是 –