Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to use inlineImageLeft in an Expo React Native project

So I was going through the React Native docs on <TextInput />

I saw a property called ‘inlineImageLeft’ and it seemed to add an icon on the left side of the <TextInput />.

But in the docs, its specified that the icon should be stored in /android/app/src/main/res/drawable

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

But I am using an Expo generated project. Is it possible to use this property on Expo?

Here is the example I tried from the react-native docs but it didn’t work:

<TextInput
    placeholder={`Search for ${currentMode}`}
    style={styles.input}
    value={searchState.search}
    onChangeText={handleChange}
    placeholderTextColor='white'
    autoCorrect={false}
    inlineImageLeft='search_icon' // Does not work
/>

>Solution :

If you are using the managed workflow (which it sounds like you are) then it is not possible to use inlineImageLeft. Even if you were in the bare workflow, this only works for Android.

You will have to build your own component that renders an icon/image inside the text input. Something like this: How can I put an icon inside a TextInput in React Native?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading