Full screen background image in React Native app

后端 未结 5 1323
野趣味
野趣味 2021-01-02 08:39

I\'m trying to set a full background image on my login view.

I found that question here in Stackoverflow: What\'s the best way to add a full screen background image

5条回答
  •  萌比男神i
    2021-01-02 09:22

    Try either of these two methods:

    The first is similar to yours except you have position: 'absolute' on your login form:

    var styles = StyleSheet.create({
        container: {
            flex: 1,
        },
        backgroundImage: {
            flex: 1,
            resizeMode: 'cover', // or 'stretch'
        },
        loginForm: {
            position: 'absolute',
            top: 0,
            bottom: 0,
            left: 0,
            right: 0
        },
    });
    

    The second method involves using the ImageView as a container:

    render: function() {
        return (
            
                
                    
                        TEST
                    
                
            
        );
    }
    

提交回复
热议问题