Skip to content

Commit 92737d3

Browse files
vovacodesnecolas
authored andcommitted
[fix] Prevent injectEventPluginsByName throwing when re-evaluating code
Close #1539
1 parent 18427aa commit 92737d3

File tree

1 file changed

+9
-3
lines changed
  • packages/react-native-web/src/exports/createElement

1 file changed

+9
-3
lines changed

packages/react-native-web/src/exports/createElement/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ import React from 'react';
1616
import ResponderEventPlugin from '../../modules/ResponderEventPlugin';
1717

1818
if (canUseDOM) {
19-
injectEventPluginsByName({
20-
ResponderEventPlugin
21-
});
19+
try {
20+
injectEventPluginsByName({
21+
ResponderEventPlugin
22+
});
23+
} catch (error) {
24+
// Ignore errors caused by attempting to re-inject the plugin when app
25+
// scripts are being re-evaluated (e.g., development hot reloading) while
26+
// the ReactDOM instance is preserved.
27+
}
2228
}
2329

2430
const isModifiedEvent = event =>

0 commit comments

Comments
 (0)