本文整理汇总了Java中com.facebook.react.common.MapBuilder类的典型用法代码示例。如果您正苦于以下问题:Java MapBuilder类的具体用法?Java MapBuilder怎么用?Java MapBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapBuilder类属于com.facebook.react.common包,在下文中一共展示了MapBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExportedCustomDirectEventTypeConstants
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
return MapBuilder.of(
REACT_ON_LOAD_START_EVENT,
MapBuilder.of("registrationName", REACT_ON_LOAD_START_EVENT),
REACT_ON_PROGRESS_EVENT,
MapBuilder.of("registrationName", REACT_ON_PROGRESS_EVENT),
REACT_ON_LOAD_EVENT,
MapBuilder.of("registrationName", REACT_ON_LOAD_EVENT),
REACT_ON_ERROR_EVENT,
MapBuilder.of("registrationName", REACT_ON_ERROR_EVENT),
REACT_ON_LOAD_END_EVENT,
MapBuilder.of("registrationName", REACT_ON_LOAD_END_EVENT)
);
}
示例2: create
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
public static ReactQueueConfigurationImpl create(
ReactQueueConfigurationSpec spec,
QueueThreadExceptionHandler exceptionHandler) {
Map<MessageQueueThreadSpec, MessageQueueThreadImpl> specsToThreads = MapBuilder.newHashMap();
MessageQueueThreadSpec uiThreadSpec = MessageQueueThreadSpec.mainThreadSpec();
MessageQueueThreadImpl uiThread =
MessageQueueThreadImpl.create( uiThreadSpec, exceptionHandler);
specsToThreads.put(uiThreadSpec, uiThread);
MessageQueueThreadImpl jsThread = specsToThreads.get(spec.getJSQueueThreadSpec());
if (jsThread == null) {
jsThread = MessageQueueThreadImpl.create(spec.getJSQueueThreadSpec(), exceptionHandler);
}
MessageQueueThreadImpl nativeModulesThread =
specsToThreads.get(spec.getNativeModulesQueueThreadSpec());
if (nativeModulesThread == null) {
nativeModulesThread =
MessageQueueThreadImpl.create(spec.getNativeModulesQueueThreadSpec(), exceptionHandler);
}
return new ReactQueueConfigurationImpl(uiThread, nativeModulesThread, jsThread);
}
示例3: testCustomBubblingEvents
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Test
public void testCustomBubblingEvents() {
ViewManager mockViewManager = mock(ViewManager.class);
List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
when(mockViewManager.getExportedCustomBubblingEventTypeConstants())
.thenReturn(MapBuilder.of("onTwirl", TWIRL_BUBBLING_EVENT_MAP));
UIManagerModule uiManagerModule = new UIManagerModule(
mReactContext,
viewManagers,
mUIImplementationProvider,
false);
Map<String, Object> constants = uiManagerModule.getConstants();
assertThat((Map) constants.get(CUSTOM_BUBBLING_EVENT_TYPES))
.contains(MapEntry.entry("onTwirl", TWIRL_BUBBLING_EVENT_MAP))
.containsKey("topChange");
}
示例4: testCustomDirectEvents
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Test
public void testCustomDirectEvents() {
ViewManager mockViewManager = mock(ViewManager.class);
List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
when(mockViewManager.getExportedCustomDirectEventTypeConstants())
.thenReturn(MapBuilder.of("onTwirl", TWIRL_DIRECT_EVENT_MAP));
UIManagerModule uiManagerModule = new UIManagerModule(
mReactContext,
viewManagers,
mUIImplementationProvider,
false);
Map<String, Object> constants = uiManagerModule.getConstants();
assertThat((Map) constants.get(CUSTOM_DIRECT_EVENT_TYPES))
.contains(MapEntry.entry("onTwirl", TWIRL_DIRECT_EVENT_MAP))
.containsKey("topLoadingStart");
}
示例5: testCustomViewConstants
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Test
public void testCustomViewConstants() {
ViewManager mockViewManager = mock(ViewManager.class);
List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
when(mockViewManager.getName()).thenReturn("RedPandaPhotoOfTheDayView");
when(mockViewManager.getExportedViewConstants())
.thenReturn(MapBuilder.of("PhotoSizeType", MapBuilder.of("Small", 1, "Large", 2)));
UIManagerModule uiManagerModule = new UIManagerModule(
mReactContext,
viewManagers,
mUIImplementationProvider,
false);
Map<String, Object> constants = uiManagerModule.getConstants();
assertThat(constants).containsKey("RedPandaPhotoOfTheDayView");
assertThat((Map) constants.get("RedPandaPhotoOfTheDayView")).containsKey("Constants");
assertThat((Map) valueAtPath(constants, "RedPandaPhotoOfTheDayView", "Constants"))
.containsKey("PhotoSizeType");
}
示例6: testNativeProps
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Test
public void testNativeProps() {
ViewManager mockViewManager = mock(ViewManager.class);
List<ViewManager> viewManagers = Arrays.asList(mockViewManager);
when(mockViewManager.getName()).thenReturn("SomeView");
when(mockViewManager.getNativeProps())
.thenReturn(MapBuilder.of("fooProp", "number"));
UIManagerModule uiManagerModule = new UIManagerModule(
mReactContext,
viewManagers,
mUIImplementationProvider,
false);
Map<String, Object> constants = uiManagerModule.getConstants();
assertThat((String) valueAtPath(constants, "SomeView", "NativeProps", "fooProp"))
.isEqualTo("number");
}
示例7: getExportedCustomDirectEventTypeConstants
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Override
public @Nullable Map<String, Object> getExportedCustomDirectEventTypeConstants() {
MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
for (String event : VideoEventEmitter.Events) {
builder.put(event, MapBuilder.of("registrationName", event));
}
return builder.build();
}
示例8: getExportedViewConstants
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Override
public @Nullable Map<String, Object> getExportedViewConstants() {
return MapBuilder.<String, Object>of(
"ScaleNone", Integer.toString(ResizeMode.RESIZE_MODE_FIT),
"ScaleAspectFit", Integer.toString(ResizeMode.RESIZE_MODE_FIT),
"ScaleToFill", Integer.toString(ResizeMode.RESIZE_MODE_FILL),
"ScaleAspectFill", Integer.toString(ResizeMode.RESIZE_MODE_CENTER_CROP)
);
}
示例9: getExportedCustomDirectEventTypeConstants
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Override
@Nullable
public Map getExportedCustomDirectEventTypeConstants() {
MapBuilder.Builder builder = MapBuilder.builder();
for (Events event : Events.values()) {
builder.put(event.toString(), MapBuilder.of("registrationName", event.toString()));
}
return builder.build();
}
示例10: getExportedViewConstants
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Override
@Nullable
public Map getExportedViewConstants() {
return MapBuilder.of(
"ScaleNone", Integer.toString(ScalableType.LEFT_TOP.ordinal()),
"ScaleToFill", Integer.toString(ScalableType.FIT_XY.ordinal()),
"ScaleAspectFit", Integer.toString(ScalableType.FIT_CENTER.ordinal()),
"ScaleAspectFill", Integer.toString(ScalableType.CENTER_CROP.ordinal())
);
}
示例11: getExportedCustomBubblingEventTypeConstants
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Nullable
@Override
public Map getExportedCustomBubblingEventTypeConstants() {
MapBuilder.Builder<String, Map> builder = MapBuilder.builder();
for (SendEventTypes evt : SendEventTypes.values()) {
builder.put(evt.toString(), MapBuilder.of("registrationName", evt.toString()));
}
Log.d(TAG, builder.toString());
return builder.build();
}
示例12: getCommandsMap
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Nullable
@Override
public Map<String, Integer> getCommandsMap() {
return MapBuilder.of(
ReceiveEventTypes.ANIMATE,
ReceiveEventTypes.ANIMATE_CODE
);
}
示例13: getExportedViewConstants
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Nullable
@Override
public Map getExportedViewConstants() {
return MapBuilder.of(
"PanCenter", Integer.toString(ExtendableImage.PAN_LIMIT_CENTER),
"PanInside", Integer.toString(ExtendableImage.PAN_LIMIT_INSIDE),
"PanOutside", Integer.toString(ExtendableImage.PAN_LIMIT_OUTSIDE),
"ScaleCenterCrop", Integer.toString(ExtendableImage.SCALE_TYPE_CENTER_CROP),
"ScaleCenterInside", Integer.toString(ExtendableImage.SCALE_TYPE_CENTER_INSIDE),
"ScaleCustom", Integer.toString(ExtendableImage.SCALE_TYPE_CUSTOM)
);
}
示例14: getExportedCustomDirectEventTypeConstants
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
public @Nullable
Map getExportedCustomDirectEventTypeConstants() {
return MapBuilder.of(
"onLoadError", MapBuilder.of("registrationName", "onLoadError"),
"onLoadSuccess", MapBuilder.of("registrationName", "onLoadSuccess")
);
}
示例15: getExportedCustomBubblingEventTypeConstants
import com.facebook.react.common.MapBuilder; //导入依赖的package包/类
@Nullable
@Override
public Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
return MapBuilder.<String, Object>builder()
.put("topOffsetChanged",
MapBuilder.of(
"phasedRegistrationNames",
MapBuilder.of(
"bubbled", "onOffsetChanged", "captured", "onOffsetChangedCapture")))
.build();
}