react-native-text-input-enhance
Version:
Text Input Enhance to fix clear text value in React Native Text Input
17 lines (14 loc) • 416 B
JavaScript
import React from 'react';
import { TextInput as T, TextInputProps } from 'react-native';
type Props = {
hasRef?: () => void,
onChangeText?: () => void
};
export default class TextInput extends React.Component<TextInputProps, Props> {
componentDidMount() {
this.props.hasRef && this.props.hasRef(this.inputRef);
}
render() {
return <T ref={ref => (this.inputRef = ref)} {...this.props} />;
}
}