Shashika Virajh
Shashika Virajh

Reputation: 9457

React-Native-Elements SearchBar Icon Not Showing

Im working on a react native app. I used react-native-elements library. The SearchBar component doesn't take the icon propery. I have imported react-native-vector-icon package as well. How to put an icon to the SearchBar?

<SearchBar
        placeholder="Type Comment"
        inputStyle={[styles.searchBar]}
        // noIcon={true}
        icon = {{type: 'MaterialCommunityIcons', color: '#86939e', name: 'share' }}
        clearIcon = {{type: 'MaterialCommunityIcons', color: '#86939e', name: 'share' }}
        round={true}

Upvotes: 0

Views: 4841

Answers (1)

Pritish Vaidya
Pritish Vaidya

Reputation: 22189

Looking at the docs, i think the type should be material-community and not MaterialCommunityIcons

<SearchBar
        placeholder="Type Comment"
        inputStyle={[styles.searchBar]}
        // noIcon={true}
        icon = {{type: 'material-community', color: '#86939e', name: 'share' }}
        clearIcon = {{type: 'material-community', color: '#86939e', name: 'share' }}
        round={true}

Upvotes: 2

Related Questions