diff --git a/src/browser/__tests__/ReactBrowserEventEmitter-test.js b/src/browser/__tests__/ReactBrowserEventEmitter-test.js index 774bb1313a..30ff4e03e3 100644 --- a/src/browser/__tests__/ReactBrowserEventEmitter-test.js +++ b/src/browser/__tests__/ReactBrowserEventEmitter-test.js @@ -275,8 +275,8 @@ describe('ReactBrowserEventEmitter', function() { expect(idCallOrder[0]).toBe(getID(CHILD)); expect(console.warn.calls.length).toEqual(1); expect(console.warn.calls[0].args[0]).toBe( - 'Returning `false` from an event handler is deprecated and will ' + - 'be ignored in a future release. Instead, manually call ' + + 'Warning: Returning `false` from an event handler is deprecated and ' + + 'will be ignored in a future release. Instead, manually call ' + 'e.stopPropagation() or e.preventDefault(), as appropriate.' ); }); diff --git a/src/browser/eventPlugins/SimpleEventPlugin.js b/src/browser/eventPlugins/SimpleEventPlugin.js index e1666ab0fe..3c933267b4 100644 --- a/src/browser/eventPlugins/SimpleEventPlugin.js +++ b/src/browser/eventPlugins/SimpleEventPlugin.js @@ -35,6 +35,7 @@ var getEventCharCode = require('getEventCharCode'); var invariant = require('invariant'); var keyOf = require('keyOf'); +var warning = require('warning'); var topLevelTypes = EventConstants.topLevelTypes; @@ -309,15 +310,13 @@ var SimpleEventPlugin = { */ executeDispatch: function(event, listener, domID) { var returnValue = EventPluginUtils.executeDispatch(event, listener, domID); - if (__DEV__) { - if (typeof returnValue === 'boolean') { - console.warn( - 'Returning `false` from an event handler is deprecated and will ' + - 'be ignored in a future release. Instead, manually call ' + - 'e.stopPropagation() or e.preventDefault(), as appropriate.' - ); - } - } + + warning( + typeof returnValue !== 'boolean', + 'Returning `false` from an event handler is deprecated and will be ' + + 'ignored in a future release. Instead, manually call ' + + 'e.stopPropagation() or e.preventDefault(), as appropriate.' + ); if (returnValue === false) { event.stopPropagation();