How to display a right icon inside a TextInput?
See original GitHub issueI’m struggling to display a right icon inside a text-input. From this article announcing version 4.0, it looks like it is possible. But there is no clear instruction in docs on how to achieve it. On the documentation page, for TextInput
, there are left
and right
props which I suppose should display e.g an icon. This is my view (Expo + React-Native):
<TextInput label="__label__" right={() => <FontAwesome5 name="edit" size={24} color="red" />} />
I also tried this way:
<TextInput label="__label__" right={<FontAwesome5 name="edit" size={24} color="red" />} />
In both cases nothing is displayed. What is the use of properties left
and right
and how to display an icon inside a TextInput?
Thank you for support.
react-native (expo version): https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz react-native-paper: ^4.0.1 @expo/vector-icons: ^10.0.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
How can I put an icon inside a TextInput in React Native?
Basically you can't put an icon inside of a textInput but you can fake it by wrapping it inside a view and setting...
Read more >CSS to put icon inside an input element in a form
The fontawesome icon can be placed by using the fa prefix before the icon's name.
Read more >TextInput.Icon · React Native Paper
A component to render a leading / trailing icon in the TextInput. ... useState(''); return ( <TextInput label="Password" secureTextEntry right={<TextInput.
Read more >How to add icons inside input elements in HTML - Educative.io
In HTML, icons are added with the <i> tag. For it to be added inside the input elements, it must be added between...
Read more >Image Icon in React Native TextInput
While working with React Native TextInput we need to assist the user in what to insert in TextInput. We can use React Native...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was also having the same issue
i fixed it using
<TextInput.Icon name="Icon-Name" />
You can pass the name of an icon from MaterialCommunityIcons. This will use the react-native-vector-icons library to display the icon.this should really be covered somewhere in the docs which IMHO are not useful in many cases.
@rizshivalli do you want to document things like this? are you open to PRs that add better docs for components?