mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
React Native: Touch Instrumentation Interface (#21024)
This commit is contained in:
@@ -184,8 +184,21 @@ function printTouchBank(): string {
|
||||
return printed;
|
||||
}
|
||||
|
||||
let instrumentationCallback: ?(string, TouchEvent) => void;
|
||||
|
||||
const ResponderTouchHistoryStore = {
|
||||
/**
|
||||
* Registers a listener which can be used to instrument every touch event.
|
||||
*/
|
||||
instrument(callback: (string, TouchEvent) => void): void {
|
||||
instrumentationCallback = callback;
|
||||
},
|
||||
|
||||
recordTouchTrack(topLevelType: string, nativeEvent: TouchEvent): void {
|
||||
if (instrumentationCallback != null) {
|
||||
instrumentationCallback(topLevelType, nativeEvent);
|
||||
}
|
||||
|
||||
if (isMoveish(topLevelType)) {
|
||||
nativeEvent.changedTouches.forEach(recordTouchMove);
|
||||
} else if (isStartish(topLevelType)) {
|
||||
|
||||
Reference in New Issue
Block a user