How to add custom elements to TextInput left or right
See original GitHub issue<TextInput // label={label} value={val} style={this.styles.TextInput} placeholder={placeholder} left={ <TextInput.Icon color="#8C8C8C" icon="lock" size={30} /> } right={ <Button mode="outlined" disabled={hasPhone} compact> "confirm" </Button> } secureTextEntry={isPwd} onChangeText={(text) => this.setText(text, filed) } />
Left can be show Element, but right can’t.
“react-native”: “0.63.2”, “react-native-paper”: “^4.1.0”, “react-native-vector-icons”: “^7.1.0”,
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
A complete guide to TextInput in React Native - LogRocket Blog
Learn how to implement React Native's TextInput component, customize it to collect user inputs, and style your fields with React Native ...
Read more >How to add icon left side in InputText in React Native
You should make use of TextInput.Icon and the left or right property as explained in the documentation here import React from 'react'; ...
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 >Custom Text Input. React Native Beginner Project Course.#7
Custom Text Input. React Native Beginner Project Course.#7Videos for the backend REST API ...
Read more >TextInput - React Native
Two methods exposed via the native element are .focus() and .blur() that will focus or blur the TextInput programmatically. Note that some props ......
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 resolved the problem using the
render
prop and styled-components, like that:Now I am able to render anything as “left” and “right”.
Why don’t just allow any component to be passed as
left
orright
? I’d like to place a non-clickable icon on the left of a<TextInput>
:But it won’t work because the
TextInputAdornment
function won’t render any element that’s not anAdornmentType.Icon
or anAdornmentType.Affix
:If a just use a
<TextInput.Icon>
without anonPress
prop, then I get an<IconButton>
, which will receive cursor events and show a ripple when tapped.