DefinitelyTyped/types/react-native-material-textfield/react-native-material-textfield-tests.tsx
Alexander Tesfamichael 97b73b3272 Add instance methods to React Native Material Textfield (#34175)
* Add methods

* Add examples of method use
2019-03-25 09:25:30 -07:00

33 lines
952 B
TypeScript

import * as React from 'react';
import { View } from 'react-native';
import { TextField } from 'react-native-material-textfield';
export class Example extends React.Component {
textFieldRef = React.createRef<TextField>();
componentDidMount() {
if (this.textFieldRef.current) {
this.textFieldRef.current.focus();
this.textFieldRef.current.blur();
this.textFieldRef.current.clear();
this.textFieldRef.current.value();
this.textFieldRef.current.isFocused();
this.textFieldRef.current.isRestricted();
}
}
render() {
return (
<View>
<TextField
label="Example"
multiline
placeholder="Text when field is empty"
value="Initial value"
style={{ fontSize: 10 }}
/>
</View>
);
}
}