[ReactNative] [SyncDiff] Create new non-coalesceable event for when native should take the responder lock

This commit is contained in:
Andy Street 2015-08-20 12:46:23 -07:00
parent c1f90c1ecf
commit a0168a8c62
1 changed files with 7 additions and 3 deletions

View File

@ -430,9 +430,13 @@ function setResponderAndExtractTransfer(
* @param {string} topLevelType Record from `EventConstants`. * @param {string} topLevelType Record from `EventConstants`.
* @return {boolean} True if a transfer of responder could possibly occur. * @return {boolean} True if a transfer of responder could possibly occur.
*/ */
function canTriggerTransfer(topLevelType, topLevelTargetID) { function canTriggerTransfer(topLevelType, topLevelTargetID, nativeEvent) {
return topLevelTargetID && ( return topLevelTargetID && (
topLevelType === EventConstants.topLevelTypes.topScroll || // responderIgnoreScroll: We are trying to migrate away from specifically tracking native scroll
// events here and responderIgnoreScroll indicates we will send topTouchCancel to handle
// canceling touch events instead
(topLevelType === EventConstants.topLevelTypes.topScroll &&
!nativeEvent.responderIgnoreScroll) ||
(trackedTouchCount > 0 && (trackedTouchCount > 0 &&
topLevelType === EventConstants.topLevelTypes.topSelectionChange) || topLevelType === EventConstants.topLevelTypes.topSelectionChange) ||
isStartish(topLevelType) || isStartish(topLevelType) ||
@ -509,7 +513,7 @@ var ResponderEventPlugin = {
ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent, nativeEventTarget); ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent, nativeEventTarget);
var extracted = canTriggerTransfer(topLevelType, topLevelTargetID) ? var extracted = canTriggerTransfer(topLevelType, topLevelTargetID, nativeEvent) ?
setResponderAndExtractTransfer( setResponderAndExtractTransfer(
topLevelType, topLevelType,
topLevelTargetID, topLevelTargetID,