mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Extract event listener from memoizedProps on Fiber instances
This makes some basic events work with Fiber. This is however not a complete solution since we may be reading the wrong Fiber.
This commit is contained in:
@@ -137,9 +137,6 @@ src/renderers/dom/shared/eventPlugins/__tests__/ChangeEventPlugin-test.js
|
||||
* should listen for both change and input events when supported
|
||||
* should only fire events when the value changes for range inputs
|
||||
|
||||
src/renderers/dom/shared/eventPlugins/__tests__/EnterLeaveEventPlugin-test.js
|
||||
* should set relatedTarget properly in iframe
|
||||
|
||||
src/renderers/dom/shared/eventPlugins/__tests__/SelectEventPlugin-test.js
|
||||
* should skip extraction if no listeners are present
|
||||
* should extract if an `onSelect` listener is present
|
||||
|
||||
@@ -605,6 +605,9 @@ src/renderers/dom/shared/eventPlugins/__tests__/BeforeInputEventPlugin-test.js
|
||||
src/renderers/dom/shared/eventPlugins/__tests__/ChangeEventPlugin-test.js
|
||||
* should unmount
|
||||
|
||||
src/renderers/dom/shared/eventPlugins/__tests__/EnterLeaveEventPlugin-test.js
|
||||
* should set relatedTarget properly in iframe
|
||||
|
||||
src/renderers/dom/shared/eventPlugins/__tests__/FallbackCompositionState-test.js
|
||||
* extracts value via `getText()`
|
||||
* extracts when inserted at start of text
|
||||
|
||||
@@ -96,7 +96,14 @@ var EventPluginHub = {
|
||||
* @return {?function} The stored callback.
|
||||
*/
|
||||
getListener: function(inst, registrationName) {
|
||||
var listener = inst._currentElement.props[registrationName];
|
||||
var listener;
|
||||
if (typeof inst.tag === 'number') {
|
||||
// TODO: This is not safe because we might want the *other* Fiber's
|
||||
// props depending on which is the current one.
|
||||
listener = inst.memoizedProps[registrationName];
|
||||
} else {
|
||||
listener = inst._currentElement.props[registrationName];
|
||||
}
|
||||
invariant(
|
||||
!listener || typeof listener === 'function',
|
||||
'Expected %s listener to be a function, instead got type %s',
|
||||
|
||||
Reference in New Issue
Block a user