mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-25 23:48:54 +00:00
[fix] TextInput onSubmitEditing event
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user