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

[TextInput] Tint color for cursor and clearButton

Open marcshilling opened this issue 11 years ago • 12 comments

Could these props be added?

Would be nice to be able to change the cursor from something other than the blue. And as for the clear button, it's not visible on a black background TextInput.

marcshilling avatar Jun 19 '15 16:06 marcshilling

tintColor: probably makes sense to expose this to all Views. Perhaps the property should be named tintColorIOS... I don't have enough context on the Android side of things to tell you what the right choice is here.

clearButton color: iOS doesn't provide a way to customize the clearButton's look AFAIK so you should build your own if you want to style it differently... one common theme amongst a lot of UIKit APIs is that if you stray away from the confines of the API author's intents (e.g. changing a text field's white background -> black background) then you need to rebuild several components from the ground up.

ide avatar Jun 19 '15 19:06 ide

You're right about the clear button - apologies for not looking into that first. UITextField's do have a rightView that can be set to a custom UIButton, but at that point it's probably easier to build a new react component.

Cursor tintColor should definitely be possible though!

marcshilling avatar Jun 19 '15 19:06 marcshilling

+1 tintColor

ghost avatar Oct 12 '15 12:10 ghost

+1 tintColor

I think it's possible on Android using textCursorDrawable.

juicemia avatar Dec 05 '15 18:12 juicemia

For iOS, you can set tint color by adding the following line to AppDelegate.m > didFinishLaunchingWithOptions self.window.tintColor = [UIColor redColor];

peter4k avatar Dec 07 '15 07:12 peter4k

or like this

 [[UITextField appearance] setTintColor:[UIColor whiteColor]]; 

I think it's really important to have tintColor accessible across all UIView, how can we do it?

gastonmorixe avatar Dec 22 '15 08:12 gastonmorixe

+1 tintColor

yuriyvl avatar Jan 19 '16 19:01 yuriyvl

+1 tintColor

d-vine avatar Feb 11 '16 21:02 d-vine

+1

lrettig avatar Feb 19 '16 19:02 lrettig

Looks like this works on iOS now with the selectionColor prop (but not on Android). We have #2555 working on the clear button tint color for iOS. Android doesn't have a clear button.

marcshilling avatar Mar 17 '16 13:03 marcshilling

You could do this globally for Android. Just pimp your styles.xml in android like this:

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <!-- sets cursor color -->
        <item name="colorControlActivated">@android:color/white</item>
    </style>
</resources>

BigPun86 avatar May 02 '16 14:05 BigPun86

It looks like, when considered as a bug there are workarounds listed here so this is kind of dealt with. I'm sure we could make this better though. I am going to close this issue, but if people would like better tint color support then I encourage folks to create/upvote a feature request on Product Pains. https://productpains.com/product/react-native?query=tint

lacker avatar Oct 24 '16 19:10 lacker