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.

TextInput `left` and `right` elements are not visible

See original GitHub issue

Current behaviour

When the textinput has right or left element, it takes up the space which is required but doesn’t show anything.

Expected behaviour

It should show the react element which is provided.

Code sample

https://snack.expo.io/@aashishdhawan/textinput?name=TextInput&description=https%3A%2F%2Fcallstack.github.io%2Freact-native-paper%2Ftext-input.html&code=import * as React from 'react'%3B import { TextInput } from 'react-native-paper'%3B const MyComponent %3D () %3D> { const [text%2C setText] %3D React.useState('')%3B return ( <TextInput label%3D"Email" value%3D{text} onChangeText%3D{text %3D> setText(text)} %2F> )%3B%0A%7D%3B%0A%0Aexport%20default%20MyComponent%3B&dependencies=react-native-paper

I have added a expo snack as well

Screenshots (if applicable)

Screenshot 2020-08-14 at 6 30 15 PM

What have you tried

I tried adding some zIndex to the container, but doesn’t work

Your Environment

software version
react-native-paper 4.0.1
node v12.16.3
npm or yarn 1.22.4
expo sdk 38

Issue Analytics

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

github_iconTop GitHub Comments

7reactions
YahyaBagiacommented, Aug 15, 2020

You have to pass <TextInput.Icon name={"ICON-NAME"}/> in the left and right props of TextInput.

import * as React from 'react';
import { View } from 'react-native'
import { TextInput } from 'react-native-paper';

const MyComponent = () => {
  const [text, setText] = React.useState('');
 const element = <TextInput.Icon name="lock-outline" />
  return (
    <TextInput
      label="Email"
      mode='outlined'
      style={{ backgroundColor: 'transparent' }}
      value={text}
      onChangeText={text => setText(text)}
      right= {element}
      left={element}
    />
  );
};

export default MyComponent;
1reaction
rizshivallicommented, Aug 24, 2020

How do i add text to right and left? it only seems to be working with <TextInput.Icon name={"ICON-NAME"}/>

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-paper TextInput icon color not working
I'm using react-native-paper TextInput to show email icon on the left side of text input and that icon should be green (#22C55E) but...
Read more >
TextInput · React Native Paper
A component to allow users to input text. ... left. Type: React.ReactNode. right. Type: React.ReactNode. disabled. Type: boolean. Default value: false.
Read more >
TextInput - React Native
When the clear button should appear on the right side of the text view. This property is supported only for single-line TextInput component....
Read more >
A complete guide to TextInput in React Native - LogRocket Blog
This is where React Native's TextInput component comes in. ... The left property tells React Native to display the desired icon on the...
Read more >
<input>: The Input (Form Input) element - HTML
A push button with no default behavior displaying the value of the value attribute, empty by default.
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