Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - TextInput inlineImageLeft not working

Tags:

react-native

I'm trying to add an image to left of my TextInput field but it's not working. I already tried putting the path, just the name of the image and also tried with require('path/to/image') but nothing seems to work.

I have something like this

<TextInput
    value={this.state.value}
    onChangeText={ (value) => this.setState({value})
    inlineImageLeft="path/to/image"
/>
like image 428
corasan Avatar asked Feb 05 '26 21:02

corasan


2 Answers

UIExplorer has an example on it, under the title 'Inline Images'.

react-native/Examples/UIExplorer/js/TextInputExample.android.js

It seems path should be relative to ./android/app/src/main/res/drawable/. Any other path does not work. Also image does not scale.

<TextInput inlineImageLeft="ic_menu_black_24dp"/>
like image 158
c6p Avatar answered Feb 09 '26 07:02

c6p


follow the react native documentation and after adding images to drawable folder clean the project from build option in android studio and rerun the project with react-native run-android. it worked for me

like image 31
sharath Avatar answered Feb 09 '26 07:02

sharath