Prevent white edges during orientation change

前端 未结 3 1178
暖寄归人
暖寄归人 2021-01-27 18:53

I reproduce this issue with the most minimal React-Native app:

render() {
  return View({style: {
    flex: 1,
    backgroundColor: \'black\'
  }})
}
         


        
3条回答
  •  梦如初夏
    2021-01-27 19:12

    I created a library, it allows you to do it from the level of JavaScript, and also allows you to do dynamic changes.

    https://github.com/johniak/react-native-root-view-background

    import { setRootViewBackgroundColor } from 'react-native-root-view-background';
    
    export default class Main extends Component {
        componentDidMount(){
            setRootViewBackgroundColor('#ccc');
        }
    }
    

提交回复
热议问题