Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import { TextInput } from 'react-native'
- class CustomTextInput extends Component {
- render() {
- return (
- <TextInput
- style={this.props.style}
- placeholder={this.props.placeholder}
- onChangeText = {this.props.onChangeText}
- value={this.props.value}
- onBlur={this.props.onBlur}
- onChange={this.props.onChange}
- onFocus={this.props.onFocus}
- />
- ); }}
- export default CustomTextInput;
- export default class ParentComponent extends BaseInput {
- render (){
- return(
- <CustomTextInput
- ref="input"
- value={value}
- onBlur={this._onBlur}
- onFocus={this._onFocus}
- onChange={this._onChange}
- />)
- }
- export default class BaseInput extends Component {
- componentWillReceiveProps(newProps) {
- const isFocused = this.refs.input.isFocused();
- if (!isFocused) {
- alert("hi")
- }
- }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement