Search code examples
reactjsuser-interfacereact-nativenative-base

ListView UI doesn't look as expected.(Native-Base)


enter image description here

Why is it showing ugly left grey margin? I tried with many different List and it's still printing left grey margin. Is this common?

I followed Native-base document : http://docs.nativebase.io/Components.html#list-avatar-headref

import { Container, Content, List, ListItem, Text, Left, Body, Thumbnail } from 'native-base';
import { View, AsyncStorage } from 'react-native';

...
render() { 
   return (
     <View style={{flex:1}}>
        <Content>
          <List>
            {this._renderProfile()}
            <ListItem>
              <Left>
                <Text>! Edit Profile</Text>
              </Left>
            </ListItem>
            <ListItem onPress={this._changePassword}>
              <Left>
                <Text>Change Password </Text>
              </Left>
            </ListItem>

            <ListItem>
              <Left>
                <Text>! Language Setting</Text>
              </Left>
            </ListItem>

            <ListItem onPress={this._showModal}>
              <Left>
                <Text>Logout</Text>
              </Left>
            </ListItem>
          </List>
        </Content>
        {this._drawModal()}
      </View>

p.s Do you like using Native-Base for UI?


Solution

  • I use like this:

    render() {
            return (
                <ListItem style={{marginLeft: -15, paddingLeft: 15}}>
                    <Left>
                        <Text>! Language Setting</Text>
                    </Left>
                </ListItem>
            );
        }
    

    and you should add avatar or icon. exm: <ListItem icon | avatart />