question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use TextInput.Icon(?)

See original GitHub issue

Hello guys, I’m new using this for developing my apps.

I’m using TextInput for phone number and wanna include some icon. but when I try to implementation like in the docs, the Icon showing missing icon like ‘X’.

“react-native”: “0.60.5”, “react-native-paper”: “^4.1.0”, “react-native-vector-icons”: “^7.1.0”,

here my app.js

import React, { Component } from 'react';
import { Provider as PaperProvider } from 'react-native-paper';
import Navigation from './src/navigasi/navigation';

// export const store = configureStore()

export default class App extends Component {
  render() {
    return (
      <PaperProvider>
        <Navigation />
      </PaperProvider>
    )
  }
}

here’s my navigation.js

const HomeNav = () => (
    <Stack.Navigator
        headerMode='none'
        initialRouteName="SplashScreen"
    >
        <Stack.Screen options={ModalAnimate} name='SplashScreen' component={SplashScreen} />
        <Stack.Screen options={SlideAnimate} name='Login' component={Login} />
        <Stack.Screen options={SlideAnimate} name='HomeDashboard' component={HomeDashboard} />
    </Stack.Navigator>
)

here my implementation the textinput in login.js.

function TextInput_() {
    const [text, setText] = React.useState('');
    return (
        <TextInput
            label="No. Handphone"
            value={text}
            onChangeText={text => setText(text)}
            left={
                <TextInput.Icon
                    name="heart"
                />
            }
        />

    )
}

here’s the image: image

so, I wanna ask how to using this TextInput.Icon or what I’ve missing?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7

github_iconTop GitHub Comments

1reaction
developer-Shivicommented, May 24, 2021

If it’s your local image just add

left={<TextInput.Icon name={require(‘…/…/assets/newIcons/expert.png’)} />}

for vector icon: right={<TextInput.Icon name=“eye” />}

1reaction
raajnadarcommented, Oct 1, 2020

Make sure the icons are loading properly this is not react native paper issue. https://github.com/oblador/react-native-vector-icons#the-icons-show-up-as-a-crossed-out-box-on-android

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I put an icon inside a TextInput in React Native?
put both Icon and TextInput inside a parent View · set flexDirection of the parent to 'row' which will align the children next...
Read more >
TextInput.Icon · React Native Paper
A component to render a leading / trailing icon in the TextInput. ... Usage. import * as React from 'react'; import { TextInput...
Read more >
Image inside TextInput Example - Expo Snack
Example of Image inside React Native Text Input.
Read more >
Image Icon in React Native TextInput
Image Icon In React Native TextInput are very good way to assist user about what to insert in a TextInput. Here is the...
Read more >
textInputIcon: Create a text input control with icon(s) - Rdrr.io
Extend form controls by adding text or icons before, after, or on both sides of a classic textInput . Usage. textInputIcon( inputId, label, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found