react-native-paper icon indicating copy to clipboard operation
react-native-paper copied to clipboard

No way to change underline focused color on TextInput without affecting other colors

Open lamecksilva opened this issue 8 years ago • 38 comments

I tried to change the cursor color in the textinput but it appears to underline, how to disable the underline? or leave it transparent?

lamecksilva avatar Dec 01 '18 23:12 lamecksilva

Hello 👋, this issue has been open for more than 2 months with no activity on it. If the issue is still present in the latest version, please leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution on workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix the issue.

github-actions[bot] avatar Jun 30 '20 00:06 github-actions[bot]

This issue is already open... please aprove https://github.com/callstack/react-native-paper/pull/1797 for close this

xchwarze avatar Jul 28 '20 20:07 xchwarze

I need to hide the underline color as I will replace it with the progress bar.

Adding theme={{ colors: { primary: 'transparent' } }} will remove the underline but also the label which is not intended.

Here is my use case: https://snack.expo.io/@dcangulo/password-with-progress-bar

dcangulo avatar Sep 08 '20 07:09 dcangulo

I need to hide the underline color as I will replace it with the progress bar.

Adding theme={{ colors: { primary: 'transparent' } }} will remove the underline but also the label which is not intended.

Here is my use case: https://snack.expo.io/@dcangulo/password-with-progress-bar

Any update?

wobsoriano avatar Sep 13 '20 10:09 wobsoriano

There isn't a way to completely remove the underline? Even with a container with hidden overflow I really need vertically grouped inputs with no underline at all.

rhuankarlus avatar Oct 02 '20 21:10 rhuankarlus

The solution from @mateusmarinho1999 works very nicely, but feels kinda hacky for me. We are chaging the primary color of the input, and what if something else now/or in future start using the primary color?

Ideally some way to specifically change the color of the underline would be better

renanborgez avatar Oct 20 '20 14:10 renanborgez

this is fixed in https://github.com/callstack/react-native-paper/pull/1797

xchwarze avatar Oct 20 '20 14:10 xchwarze

this is fixed in #1797

is this working?

HassanHaiderIX avatar Jan 21 '21 05:01 HassanHaiderIX

this is fixed in #1797

is this working?

@HassanHaiderIX Yes, I'm currently using this on my code and works like a charm

renanborgez avatar Jan 21 '21 09:01 renanborgez

this is fixed in #1797

is this working?

@HassanHaiderIX Yes, I'm currently using this on my code and works like a charm

Sorry for being naive but I dont see that PR being merged. I am not sure how can I hide underline color

HassanHaiderIX avatar Jan 21 '21 10:01 HassanHaiderIX

this is fixed in #1797

is this working?

@HassanHaiderIX Yes, I'm currently using this on my code and works like a charm

Sorry for being naive but I dont see that PR being merged. I am not sure how can I hide underline color

sorry, I was not clear I'm using but not from the release channel, I've just implemented that PR by myself on my code

renanborgez avatar Jan 21 '21 14:01 renanborgez

I just don't want to have the "underline", but the animated label and everything else I'd like to have. Unfortunately not every design follows 100% of Material Design. (I have never worked on a project that follow 100% of the recommendations) To whom it may concern, to "hide" the underline I followed this workaround.

const styles = StyleSheet.create({
    inputContainer: {
        borderRadius: 4,
        height: 55,
        overflow: 'hidden',
    },
    input: {
        borderRadius: 0,
        borderTopLeftRadius: 0,
        borderTopRightRadius: 0,
        height: 57,
        overflow: 'hidden',
        backgroundColor: '#fff',
    },
};
...
<View style={styles.inputContainer}>
       <TextInput
            mode="flat"
            label="Username"
            style={styles.input}
        />
</View>

Note that Input is 2 pixels bigger than View. mrocto

I know its not answer, but it solves

I just don't want to have the "underline", but the animated label and everything else I'd like to have.

Unfortunately not every design follows 100% of Material Design. (I have never worked on a project that follow 100% of the recommendations)

To whom it may concern, to "hide" the underline I followed this workaround.

const styles = StyleSheet.create({
    inputContainer: {
        borderRadius: 4,
        height: 55,
        overflow: 'hidden',
    },
    input: {
        borderRadius: 0,
        borderTopLeftRadius: 0,
        borderTopRightRadius: 0,
        height: 57,
        overflow: 'hidden',
        backgroundColor: '#fff',
    },
};
...
<View style={styles.inputContainer}>
       <TextInput
            mode="flat"
            label="Username"
            style={styles.input}
        />
</View>

Note that Input is 2 pixels bigger than View.

mrocto

it's a bit dirty hack but made got me an idea and it might be bit better (added -2 marginBottom) this how the height is dynamic image

OrLevy23 avatar Sep 01 '21 16:09 OrLevy23

This is way to solved this problem

  • underlineColor="transparent"

<TextInput
          placeholder="Write something with multilines  here.."
          underlineColor="transparent"
          theme={{ colors: { primary: 'transparent' } }}
          style={{
            maxHeight: 300,
            backgroundColor: 'none',
            width: '100%',
          }}

        />

Hasintha-git avatar Dec 02 '21 06:12 Hasintha-git

hey @Hasintha-git the problem still persists though, if you want to add a label it won't be visible as color 'transparent' get's applied on the label as well. I can confirm the issue is still there on 4.12.0. does anybody have idea how to resolve this?

johanjq avatar Mar 31 '22 12:03 johanjq

~How to change only underline color but not the cursor color in iOS?~

Found the answer

underlineColor={'transparent'}
selectionColor={'blue'}
activeUnderlineColor={'transparent'}

phanithken avatar Sep 08 '22 08:09 phanithken

underlineStyle={{ display: 'none', }}

kholidanas27 avatar Oct 03 '23 18:10 kholidanas27

Stop being idiots answering an issue from 2018. There was no way to do this in 2018!

xchwarze avatar Jul 12 '24 17:07 xchwarze

Try this:- <TextInput label={'Phone Number'} style={styles.phoneNumberInput} keyboardType="phone-pad" onChangeText={this.handlePhoneNumberChange} value={this.state.phoneNumber} underlineStyle={{ display: 'none', }} theme={{ colors: { primary: 'black', }, }}

        And the line will be invisible.
         underlineStyle={{
              display: 'none',
            }}

Anshul-AI2659 avatar Sep 25 '24 05:09 Anshul-AI2659