Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import { TextInput } from 'react-native'
  3. class CustomTextInput extends Component {
  4. render() {
  5. return (
  6. <TextInput
  7. style={this.props.style}
  8. placeholder={this.props.placeholder}
  9. onChangeText = {this.props.onChangeText}
  10. value={this.props.value}
  11. onBlur={this.props.onBlur}
  12. onChange={this.props.onChange}
  13. onFocus={this.props.onFocus}
  14. />
  15. ); }}
  16. export default CustomTextInput;
  17.  
  18. export default class ParentComponent extends BaseInput {
  19.  
  20. render (){
  21. return(
  22. <CustomTextInput
  23. ref="input"
  24. value={value}
  25. onBlur={this._onBlur}
  26. onFocus={this._onFocus}
  27. onChange={this._onChange}
  28. />)
  29.  
  30. }
  31.  
  32. export default class BaseInput extends Component {
  33. componentWillReceiveProps(newProps) {
  34.  
  35. const isFocused = this.refs.input.isFocused();
  36. if (!isFocused) {
  37. alert("hi")
  38. }
  39. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement