halilb / react-native-textinput-effects

Text inputs with custom label and icon animations for iOS and android. Built with react native and inspired by Codrops.
MIT License
2.98k stars 291 forks source link

Feature Request: Placeholder Text Color #91

Closed wizebin closed 5 years ago

wizebin commented 5 years ago

Feature Request Description

Currently as a consumer of this library I have no way to control the placeholder color of the input field

Code

Something as simple as this would get the job done (sample from the fumi class)

       <Animated.Text
          style={[
            styles.label,
            {
              fontSize: focusedAnim.interpolate({
                inputRange: [0, 0.7, 0.71, 1],
                outputRange: [16, 16, 12, 12],
              }),
              color: focusedAnim.interpolate({
                inputRange: [0, 0.7],
                outputRange: [placeholderColor || '#696969', placeholderComposite || '#a3a3a3'],
              }),
            },
            labelStyle,
          ]}
        >

The new props could be something along the lines of the placeholderColor and placeholderComposite that I've added in this sample.

Reasoning

I would like to validate my user's input and indicate missing fields with a simple color change, currently I can add a different style like a border color, but a placeholder color would be slightly better.

screen shot 2019-02-10 at 9 32 23 pm screen shot 2019-02-10 at 9 32 35 pm

Alternative

Having a custom placeholder component would fulfill this need

https://github.com/halilb/react-native-textinput-effects/issues/12

wizebin commented 5 years ago

Nope, I'm crazy, missed the labelStyle prop- that suits my needs just fine!

halilb commented 5 years ago

I'm glad you figured it out @wizebin :)