File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ import {
4242} from 'react-reconciler/inline.dom' ;
4343import { createPortal as createPortalImpl } from 'shared/ReactPortal' ;
4444import { canUseDOM } from 'shared/ExecutionEnvironment' ;
45- import createEventComponent from 'shared/createEventComponent' ;
45+ import createEvent from 'shared/createEventComponent' ;
4646import { setBatchingImplementation } from 'events/ReactGenericBatching' ;
4747import {
4848 setRestoreImplementation ,
@@ -882,7 +882,7 @@ if (enableStableConcurrentModeAPIs) {
882882}
883883
884884if ( enableEventAPI ) {
885- ReactDOM . unstable_createEventComponent = createEventComponent ;
885+ ReactDOM . unstable_createEvent = createEvent ;
886886}
887887
888888const foundDevTools = injectIntoDevTools ( {
Original file line number Diff line number Diff line change @@ -42,12 +42,10 @@ function createReactEventComponent({
4242 allowMultipleHostChildren : allowMultipleHostChildren || false ,
4343 } ;
4444
45- return {
46- $$typeof : Symbol . for ( 'react.event_component' ) ,
47- displayName : 'TestEventComponent' ,
48- props : null ,
49- responder : testEventResponder ,
50- } ;
45+ return ReactDOM . unstable_createEvent (
46+ testEventResponder ,
47+ 'TestEventComponent' ,
48+ ) ;
5149}
5250
5351function dispatchEvent ( element , type ) {
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ import invariant from 'shared/invariant';
7070import lowPriorityWarning from 'shared/lowPriorityWarning' ;
7171import warningWithoutStack from 'shared/warningWithoutStack' ;
7272import { enableStableConcurrentModeAPIs } from 'shared/ReactFeatureFlags' ;
73+ import createEvent from 'shared/createEventComponent' ;
7374
7475import {
7576 getInstanceFromNode ,
@@ -86,6 +87,7 @@ import {
8687 DOCUMENT_FRAGMENT_NODE ,
8788} from '../shared/HTMLNodeType' ;
8889import { ROOT_ATTRIBUTE_NAME } from '../shared/DOMProperty' ;
90+ import { enableEventAPI } from 'shared/ReactFeatureFlags' ;
8991
9092const ReactCurrentOwner = ReactSharedInternals . ReactCurrentOwner ;
9193
@@ -883,6 +885,10 @@ if (enableStableConcurrentModeAPIs) {
883885 ReactDOM . createSyncRoot = createSyncRoot ;
884886}
885887
888+ if ( enableEventAPI ) {
889+ ReactDOM . unstable_createEvent = createEvent ;
890+ }
891+
886892const foundDevTools = injectIntoDevTools ( {
887893 findFiberByHostInstance : getClosestInstanceFromNode ,
888894 bundleType : __DEV__ ? 1 : 0 ,
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ can be found [here](./docs).
1212
1313## EventComponent
1414
15- An Event Component is defined using ` React.unstable_createEventComponent ` :
15+ An Event Component is defined using ` ReactDOM.unstable_createEvent ` :
1616
1717``` js
18- const EventComponent = React . unstable_createEventComponent (
18+ const EventComponent = ReactDOM . unstable_createEvent (
1919 responder: EventResponder,
2020 displayName: string
2121);
Original file line number Diff line number Diff line change @@ -259,4 +259,4 @@ const DragResponder = {
259259 } ,
260260} ;
261261
262- export default ReactDOM . unstable_createEventComponent ( DragResponder , 'Drag' ) ;
262+ export default ReactDOM . unstable_createEvent ( DragResponder , 'Drag' ) ;
Original file line number Diff line number Diff line change @@ -336,4 +336,4 @@ const FocusResponder = {
336336 } ,
337337} ;
338338
339- export default ReactDOM . unstable_createEventComponent ( FocusResponder , 'Focus' ) ;
339+ export default ReactDOM . unstable_createEvent ( FocusResponder , 'Focus' ) ;
Original file line number Diff line number Diff line change @@ -157,7 +157,4 @@ const FocusScopeResponder = {
157157 } ,
158158} ;
159159
160- export default ReactDOM . unstable_createEventComponent (
161- FocusScopeResponder ,
162- 'FocusScope' ,
163- ) ;
160+ export default ReactDOM . unstable_createEvent ( FocusScopeResponder , 'FocusScope' ) ;
Original file line number Diff line number Diff line change @@ -406,4 +406,4 @@ const HoverResponder = {
406406 } ,
407407} ;
408408
409- export default ReactDOM . unstable_createEventComponent ( HoverResponder , 'Hover' ) ;
409+ export default ReactDOM . unstable_createEvent ( HoverResponder , 'Hover' ) ;
Original file line number Diff line number Diff line change @@ -970,4 +970,4 @@ const PressResponder = {
970970 } ,
971971} ;
972972
973- export default ReactDOM . unstable_createEventComponent ( PressResponder , 'Press' ) ;
973+ export default ReactDOM . unstable_createEvent ( PressResponder , 'Press' ) ;
Original file line number Diff line number Diff line change @@ -211,7 +211,4 @@ const ScrollResponder = {
211211 } ,
212212} ;
213213
214- export default ReactDOM . unstable_createEventComponent (
215- ScrollResponder ,
216- 'Scroll' ,
217- ) ;
214+ export default ReactDOM . unstable_createEvent ( ScrollResponder , 'Scroll' ) ;
You can’t perform that action at this time.
0 commit comments