Skip to content

Commit

Permalink
Ignore events on text nodes (#9000)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sebmarkbage committed Feb 14, 2017
1 parent 7bdc189 commit 5a1e30a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/renderers/shared/shared/event/EventPluginHub.js
Expand Up @@ -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)) {
Expand Down

0 comments on commit 5a1e30a

Please sign in to comment.