Ignore events on text nodes (#9000)

In React Native events can fire on text nodes (on Android at least).

In that case, the current element will be a string and not props. These
can not have event handlers on them so we need to bail out so that
we don't throw later on.
This commit is contained in:
Sebastian Markbåge 2017-02-14 11:08:29 -08:00 committed by GitHub
parent 7bdc189147
commit 5a1e30a868
1 changed files with 4 additions and 0 deletions

View File

@ -138,6 +138,10 @@ var EventPluginHub = {
return null;
}
} else {
if (typeof inst._currentElement === 'string') {
// Text node, let it bubble through.
return null;
}
const props = inst._currentElement.props;
listener = props[registrationName];
if (shouldPreventMouseEvent(registrationName, inst._currentElement.type, props)) {