Make an item stick to the bottom using flex in react-native

前端 未结 13 2389
别跟我提以往
别跟我提以往 2020-12-13 23:37

Suppose this is the layout:


    
        ...
        ...
    
             


        
13条回答
  •  渐次进展
    2020-12-14 00:30

    I would use the following approach:

    
    
         {/* <- Add this */}
    
            
                ...
            
            
                ...
            
    
        
    
        
            ...
        
    
    
    var styles = StyleSheet.create({
        container: {
            flex: 1,
            backgroundColor: '#F5FCFF',
        },
        titleWrapper: {
    
        },
        inputWrapper: {
    
        },
        contentContainer: {
            flex: 1 // pushes the footer to the end of the screen
        },
        footer: {
            height: 100
        }
    });
    

    This way the styles of titleWrapper and inputWrapper can be updated without breaking the layout of your app and the components themselves are easier to re-use :)

提交回复
热议问题