Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
75 views
in Technique[技术] by (71.8m points)

ListItem not showing information - React Native Elements

When I use it works fine. But when I try to use , nothing appears.

That's my code:

export default props => {
    //console.warn(Object.keys(props))
    function getUserItem({item: user}) {
        console.warn(user.name)
        return (
            <ListItem
                leftAvatar={{source: {uri: user.avatarUrl}}}
                key={user.id}
                title={user.name}
            />
        )
    }
    return (
        <View>
            <FlatList
                keyExtractor={user=>user.id.toString()}
                data={users}
                renderItem={getUserItem}
            />
        </View>
    )
}

Can anybody helps me? Thank you!!!

question from:https://stackoverflow.com/questions/65648088/listitem-not-showing-information-react-native-elements

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use this way

 <View style={{flex:1}}>
   ...
 </View>

 const getUserItem = ({item: user}) => {
       ...
 }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...