forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use browser event names for top-level event types in React DOM (faceb…
…ook#12629) * Add TopLevelEventTypes * Fix `ReactBrowserEventEmitter` * Fix EventPluginUtils * Fix TapEventPlugin * Fix ResponderEventPlugin * Update ReactDOMFiberComponent * Fix BeforeInputEventPlugin * Fix ChangeEventPlugin * Fix EnterLeaveEventPlugin * Add missing non top event type used in ChangeEventPlugin * Fix SelectEventPlugin * Fix SimpleEventPlugin * Fix outstanding Flow issues and move TopLevelEventTypes * Inline a list of all events in `ReactTestUtils` * Fix tests * Make it pretty * Fix completly unrelated typo * Don’t use map constructor because of IE11 * Update typings, revert changes to native code * Make topLevelTypes in ResponderEventPlugin injectable and create DOM and ReactNative variant * Set proper dependencies for DOMResponderEventPlugin * Prettify * Make some react dom tests no longer depend on internal API * Use factories to create top level speific generic event modules * Remove unused dependency * Revert exposed module renaming, hide store creation, and inline dependency decleration * Add Flow types to createResponderEventPlugin and its consumers * Remove unused dependency * Use opaque flow type for TopLevelType * Add missing semis * Use raw event names as top level identifer * Upgrade baylon This is required for parsing opaque flow types in our CI tests. * Clean up flow types * Revert Map changes of ReactBrowserEventEmitter * Upgrade babel-* packages Apparently local unit tests also have issues with parsing JavaScript modules that contain opaque types (not sure why I didn't notice earlier!?). * Revert Map changes of SimpleEventPlugin * Clean up ReactTestUtils * Add missing semi * Fix Flow issue * Make TopLevelType clearer * Favor for loops * Explain the new DOMTopLevelEventTypes concept * Use static injection for Responder plugin types * Remove null check and rely on flow checks * Add missing ResponderEventPlugin dependencies
- Loading branch information
1 parent
1047980
commit e96dc14
Showing
32 changed files
with
1,965 additions
and
996 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
export const TOP_TOUCH_START = 'topTouchStart'; | ||
export const TOP_TOUCH_MOVE = 'topTouchMove'; | ||
export const TOP_TOUCH_END = 'topTouchEnd'; | ||
export const TOP_TOUCH_CANCEL = 'topTouchCancel'; | ||
export const TOP_SCROLL = 'topScroll'; | ||
export const TOP_SELECTION_CHANGE = 'topSelectionChange'; | ||
|
||
export function isStartish(topLevelType: mixed): boolean { | ||
return topLevelType === TOP_TOUCH_START; | ||
} | ||
|
||
export function isMoveish(topLevelType: mixed): boolean { | ||
return topLevelType === TOP_TOUCH_MOVE; | ||
} | ||
|
||
export function isEndish(topLevelType: mixed): boolean { | ||
return topLevelType === TOP_TOUCH_END || topLevelType === TOP_TOUCH_CANCEL; | ||
} | ||
|
||
export const startDependencies = [TOP_TOUCH_START]; | ||
export const moveDependencies = [TOP_TOUCH_MOVE]; | ||
export const endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
import type {DOMTopLevelEventType} from 'react-dom/src/events/DOMTopLevelEventTypes'; | ||
|
||
type RNTopLevelEventType = | ||
| 'topMouseDown' | ||
| 'topMouseMove' | ||
| 'topMouseUp' | ||
| 'topScroll' | ||
| 'topSelectionChange' | ||
| 'topTouchCancel' | ||
| 'topTouchEnd' | ||
| 'topTouchMove' | ||
| 'topTouchStart'; | ||
|
||
export type TopLevelType = DOMTopLevelEventType | RNTopLevelEventType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
// Note: ideally these would be imported from DOMTopLevelEventTypes, | ||
// but our build system currently doesn't let us do that from a fork. | ||
|
||
export const TOP_TOUCH_START = 'touchstart'; | ||
export const TOP_TOUCH_MOVE = 'touchmove'; | ||
export const TOP_TOUCH_END = 'touchend'; | ||
export const TOP_TOUCH_CANCEL = 'touchcancel'; | ||
export const TOP_SCROLL = 'scroll'; | ||
export const TOP_SELECTION_CHANGE = 'selectionchange'; | ||
export const TOP_MOUSE_DOWN = 'mousedown'; | ||
export const TOP_MOUSE_MOVE = 'mousemove'; | ||
export const TOP_MOUSE_UP = 'mouseup'; | ||
|
||
export function isStartish(topLevelType: mixed): boolean { | ||
return topLevelType === TOP_TOUCH_START || topLevelType === TOP_MOUSE_DOWN; | ||
} | ||
|
||
export function isMoveish(topLevelType: mixed): boolean { | ||
return topLevelType === TOP_TOUCH_MOVE || topLevelType === TOP_MOUSE_MOVE; | ||
} | ||
|
||
export function isEndish(topLevelType: mixed): boolean { | ||
return ( | ||
topLevelType === TOP_TOUCH_END || | ||
topLevelType === TOP_TOUCH_CANCEL || | ||
topLevelType === TOP_MOUSE_UP | ||
); | ||
} | ||
|
||
export const startDependencies = [TOP_TOUCH_START, TOP_MOUSE_DOWN]; | ||
export const moveDependencies = [TOP_TOUCH_MOVE, TOP_MOUSE_MOVE]; | ||
export const endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_MOUSE_UP]; |
Oops, something went wrong.