diff --git a/RNTester/js/TextInputExample.macos.js b/RNTester/js/TextInputExample.macos.js
index e3468c0760..0e80693eb3 100644
--- a/RNTester/js/TextInputExample.macos.js
+++ b/RNTester/js/TextInputExample.macos.js
@@ -60,6 +60,9 @@ class TextEventsExample extends React.Component<{}, $FlowFixMeState> {
onChange={event =>
this.updateText('onChange text: ' + event.nativeEvent.text)
}
+ onTextInput={event =>
+ this.updateText('onTextInput: ' + JSON.stringify(event.nativeEvent))
+ }
onEndEditing={event =>
this.updateText('onEndEditing text: ' + event.nativeEvent.text)
}
@@ -489,6 +492,47 @@ class AutogrowingTextInputExample extends React.Component<
}
}
+class ControlledResetExample extends React.Component<
+ $FlowFixMeProps,
+ $FlowFixMeState,
+> {
+ constructor(props) {
+ super(props);
+ this.state = {
+ text: '',
+ keys: '',
+ };
+ }
+
+ render() {
+ return (
+
+
+
+ Text: {this.state.text}
+ Keys: {this.state.keys}
+
+ );
+ }
+
+ onChangeText = (text: string) => {
+ this.setState({text});
+ };
+
+ onKeyPress = ({nativeEvent}: Object) => {
+ this.setState({keys: this.state.keys + nativeEvent.key + ', '});
+ };
+
+ onReset = () => {
+ this.setState({text: '', keys: ''});
+ };
+}
+
const styles = StyleSheet.create({
default: {
borderWidth: StyleSheet.hairlineWidth,
@@ -1104,4 +1148,10 @@ exports.examples = [
);
},
},
+ {
+ title: 'Controlled reset',
+ render: function() {
+ return ;
+ },
+ },
];