本文整理匯總了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();
}