[fix] TextInput onSubmitEditing event

This commit is contained in:
Nicolas Gallagher
2017-06-26 10:38:53 -07:00
parent 99348eaedb
commit 20257afe88
2 changed files with 3 additions and 0 deletions
@@ -232,6 +232,8 @@ describe('components/TextInput', () => {
);
input.simulate('keyPress', { which: 13 });
function onSubmitEditing(e) {
expect(e.nativeEvent.target).toBeDefined();
expect(e.nativeEvent.text).toBe('12345');
done();
}
});
+1
View File
@@ -320,6 +320,7 @@ class TextInput extends Component {
if (!e.isDefaultPrevented() && e.which === 13) {
if (onSubmitEditing) {
e.nativeEvent = { target: e.target, text: e.target.value };
onSubmitEditing(e);
}
if (shouldBlurOnSubmit) {