on focused text input style react native

You can achieve this by passing in the onFocus and onBlur events to set and unset styles when focused and blurred:

  onFocus() {
    this.setState({
        backgroundColor: 'green'
    })
  },

  onBlur() {
    this.setState({
      backgroundColor: '#ededed'
    })
  },
And then, in the TextInput do this:

<TextInput 
    onBlur={ () => this.onBlur() }
    onFocus={ () => this.onFocus() }
    style={{ height:60, backgroundColor: this.state.backgroundColor, color: this.state.color }}  />

3.5
4
Graffito 140 points

                                    &lt;TextInput theme={{ colors: { primary: &quot;color of your wish&quot; } }} /&gt;

3.5 (4 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
style focused input react native react native css focus react input focused style on focus react native style textinput styling on focus react native rntextinput highlight on focus react native text input is focused ::focus text input react native add focus property in react native styling onFocus style react native text input react native text input set focused react native focus style input focus style react native react native android text input focused background color yellow const styles reactjs focus react native input text android focus color yellow react native onFocus style onfocus in react native on focused text input style react native style text input react native on hover react native onfocus bordercolor react set style on focus react styling focus react onfocus change style react style onFocus react style focus onfocus react native text input color is just working on focus focus color change reacat react style on focus highlight text react native react native TextInputonFocus={handleInputFocus} react native elements button highlight react native input focus style onfocus react native text input order change giving style to textinput react native how to change on focus textinput border in react native on textInput focus a style type react native url time change style focos function in react js react native text input get focus state how change color input onfocus react js react native textinput onfocus example react native element input onfocus react native textinput focus style react native textinput focus color chane style of textinput using ref react native events focus textbox react native react native element input focus not working react native elements input focus change color onfocus input react native how to make input field onfocus reactnative react native textinput active border react native style with no focus react native style no focus focus css in react native input hover and focus react react js focus styles react native elements input highlight onfous
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source