react-native-search-bar icon indicating copy to clipboard operation
react-native-search-bar copied to clipboard

Remove underline on Android

Open dan-fein opened this issue 5 years ago • 8 comments

Is it possible to remove the underline that appears on Android?

I see the native TextInput has a prop called underlineColorAndroid="transparent" but checking the TS file I don't see anything for this, any work arounds to achieve it?

Screenshot 2019-10-23 23 32 50

dan-fein avatar Oct 24 '19 03:10 dan-fein

@alpha0010 How hard would it be to add this?

iRoachie avatar Oct 24 '19 12:10 iRoachie

Hmm. Surprisingly difficult unfortunately. This is implemented via a SearchView, not a TextInput. As such, in order to modify unexposed styles, one must parse the element for the appropriate base widget to modify. The "underline" is not (on most platforms) implemented as an actual underline. Automatically determining the underline would be hard to confidently implement for all targeted SDKs.

The only solid option I can think of would be re-implementing the entire widget (off of primitive components), which rather feels like it defeats the goal of being completely native.

alpha0010 avatar Oct 28 '19 20:10 alpha0010

Same issue

RodolfoGS avatar Dec 25 '19 19:12 RodolfoGS

I'm thinking of use a view to overlap the underline to hide it.

Noitidart avatar Jan 05 '20 23:01 Noitidart

Oh gosh my overlaid view covers hanging part of characters, that was silly of me.

Noitidart avatar Jan 07 '20 13:01 Noitidart

Did some searching around. You may be able to adapt this solution: https://stackoverflow.com/a/27687155

Also, grep for search_plate and mSearchPlate in the Android sdk source.

If you are trying your hand at this, be aware the hard part with react native style properties is to correctly (re)apply the native styles when the JS code does not explicitly set a value.

alpha0010 avatar Jan 07 '20 18:01 alpha0010

Is there any update on this?

Ainias avatar Feb 02 '22 14:02 Ainias

set query backround to transparant

YogaSulistiyoWidodo avatar Oct 18 '23 10:10 YogaSulistiyoWidodo