Fix scrolling events for RN.

Reviewed By: bvaughn

Differential Revision: D6020664

fbshipit-source-id: c9fb9069e9dcde298901ba2c03bacc8b646844d0
This commit is contained in:
Dmitry Zakharov 2017-10-10 10:50:58 -07:00 committed by Facebook Github Bot
parent e50464d1d7
commit ca834f96af
1 changed files with 18 additions and 15 deletions

View File

@ -9,17 +9,12 @@
package com.facebook.react.uimanager;
import java.util.HashMap;
import java.util.Map;
import android.util.DisplayMetrics;
import android.view.accessibility.AccessibilityEvent;
import android.widget.ImageView;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.uimanager.events.TouchEventType;
import java.util.Map;
/**
* Constants exposed to JS from {@link UIManagerModule}.
@ -81,19 +76,27 @@ import com.facebook.react.uimanager.events.TouchEventType;
}
/* package */ static Map getDirectEventTypeConstants() {
final String rn = "registrationName";
return MapBuilder.builder()
.put("topContentSizeChange", MapBuilder.of("registrationName", "onContentSizeChange"))
.put("topLayout", MapBuilder.of("registrationName", "onLayout"))
.put("topLoadingError", MapBuilder.of("registrationName", "onLoadingError"))
.put("topLoadingFinish", MapBuilder.of("registrationName", "onLoadingFinish"))
.put("topLoadingStart", MapBuilder.of("registrationName", "onLoadingStart"))
.put("topSelectionChange", MapBuilder.of("registrationName", "onSelectionChange"))
.put("topMessage", MapBuilder.of("registrationName", "onMessage"))
.put("topContentSizeChange", MapBuilder.of(rn, "onContentSizeChange"))
.put("topLayout", MapBuilder.of(rn, "onLayout"))
.put("topLoadingError", MapBuilder.of(rn, "onLoadingError"))
.put("topLoadingFinish", MapBuilder.of(rn, "onLoadingFinish"))
.put("topLoadingStart", MapBuilder.of(rn, "onLoadingStart"))
.put("topSelectionChange", MapBuilder.of(rn, "onSelectionChange"))
.put("topMessage", MapBuilder.of(rn, "onMessage"))
// Scroll events are added as per task T22348735.
// Subject for further improvement.
.put("topScrollBeginDrag", MapBuilder.of(rn, "onScrollBeginDrag"))
.put("topScrollEndDrag", MapBuilder.of(rn, "onScrollEndDrag"))
.put("topScroll", MapBuilder.of(rn, "onScroll"))
.put("topMomentumScrollBegin", MapBuilder.of(rn, "onMomentumScrollBegin"))
.put("topMomentumScrollEnd", MapBuilder.of(rn, "onMomentumScrollEnd"))
.build();
}
public static Map<String, Object> getConstants() {
HashMap<String, Object> constants = new HashMap<String, Object>();
Map<String, Object> constants = MapBuilder.newHashMap();
constants.put(
"UIView",
MapBuilder.of(