From 77366cd8696cb8ada3f84d7fb4d36a27f7007b06 Mon Sep 17 00:00:00 2001 From: Luna Wei Date: Mon, 21 Jun 2021 22:59:30 -0700 Subject: [PATCH] Remove Picker from OSS Summary: Changelog: [General][Removed] - Remove Picker code from Android Reviewed By: ShikaSD Differential Revision: D29123164 fbshipit-source-id: 4471ea5f52885735ead07a656452ed5ef2bff65b --- .../java/com/facebook/react/tests/BUCK | 1 - .../com/facebook/react/fabric/jni/Android.mk | 3 +- .../java/com/facebook/react/fabric/jni/BUCK | 1 - .../fabric/jni/CoreComponentsRegistry.cpp | 6 - .../main/java/com/facebook/react/shell/BUCK | 1 - .../react/shell/MainReactPackage.java | 4 - .../AndroidDialogPickerManagerDelegate.java | 48 ----- .../AndroidDialogPickerManagerInterface.java | 23 -- .../AndroidDropdownPickerManagerDelegate.java | 48 ----- ...AndroidDropdownPickerManagerInterface.java | 22 -- .../java/com/facebook/react/views/picker/BUCK | 30 --- .../picker/ReactDialogPickerManager.java | 51 ----- .../picker/ReactDropdownPickerManager.java | 50 ----- .../react/views/picker/ReactPicker.java | 196 ------------------ .../views/picker/ReactPickerAdapter.java | 95 --------- .../react/views/picker/ReactPickerItem.java | 43 ---- .../views/picker/ReactPickerManager.java | 99 --------- .../picker/events/PickerItemSelectEvent.java | 42 ---- .../renderer/components/picker/Android.mk | 37 ---- .../react/renderer/components/picker/BUCK | 98 --------- .../AndroidDialogPickerComponentDescriptor.h | 21 -- .../AndroidDialogPickerEventEmitter.cpp | 23 -- .../AndroidDialogPickerEventEmitter.h | 27 --- .../AndroidDialogPickerProps.cpp | 28 --- .../androidpicker/AndroidDialogPickerProps.h | 77 ------- .../AndroidDialogPickerShadowNode.cpp | 16 -- .../AndroidDialogPickerShadowNode.h | 29 --- ...AndroidDropdownPickerComponentDescriptor.h | 21 -- .../AndroidDropdownPickerEventEmitter.cpp | 23 -- .../AndroidDropdownPickerEventEmitter.h | 27 --- .../AndroidDropdownPickerProps.cpp | 28 --- .../AndroidDropdownPickerProps.h | 77 ------- .../AndroidDropdownPickerShadowNode.cpp | 17 -- .../AndroidDropdownPickerShadowNode.h | 29 --- 34 files changed, 1 insertion(+), 1340 deletions(-) delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDialogPickerManagerDelegate.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDialogPickerManagerInterface.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDropdownPickerManagerDelegate.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDropdownPickerManagerInterface.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/picker/BUCK delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactDialogPickerManager.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactDropdownPickerManager.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPicker.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerAdapter.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerItem.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerManager.java delete mode 100644 ReactAndroid/src/main/java/com/facebook/react/views/picker/events/PickerItemSelectEvent.java delete mode 100644 ReactCommon/react/renderer/components/picker/Android.mk delete mode 100644 ReactCommon/react/renderer/components/picker/BUCK delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerComponentDescriptor.h delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerEventEmitter.cpp delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerEventEmitter.h delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerProps.cpp delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerProps.h delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerShadowNode.cpp delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerShadowNode.h delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerComponentDescriptor.h delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerEventEmitter.cpp delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerEventEmitter.h delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerProps.cpp delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerProps.h delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerShadowNode.cpp delete mode 100644 ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerShadowNode.h diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK index 6cd9d22f56df70..451cd7413b9686 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/BUCK @@ -33,7 +33,6 @@ rn_android_library( react_native_target("java/com/facebook/react/uimanager:uimanager"), react_native_target("java/com/facebook/react/uimanager/annotations:annotations"), react_native_target("java/com/facebook/react/uimanager/util:util"), - react_native_target("java/com/facebook/react/views/picker:picker"), react_native_target("java/com/facebook/react/views/progressbar:progressbar"), react_native_target("java/com/facebook/react/views/scroll:scroll"), react_native_target("java/com/facebook/react/views/slider:slider"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk index 528235e8f3ebe3..827112595cefa4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk @@ -11,7 +11,7 @@ LOCAL_MODULE := fabricjni LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) -LOCAL_SHARED_LIBRARIES := libreactconfig librrc_slider librrc_progressbar librrc_switch librrc_modal libyoga libglog libfb libfbjni libglog_init libfolly_json libfolly_futures libreact_render_mounting libreactnativeutilsjni libreact_utils libreact_render_debug libreact_render_graphics libreact_render_core react_render_componentregistry librrc_view librrc_unimplementedview librrc_root librrc_scrollview libbetter libreact_render_attributedstring libreact_render_uimanager libreact_render_templateprocessor libreact_render_scheduler libreact_render_animations libreact_render_imagemanager libreact_render_textlayoutmanager libreact_codegen_rncore rrc_text librrc_image librrc_textinput librrc_picker libreact_debug libreact_render_mapbuffer libmapbufferjni libreact_render_telemetry +LOCAL_SHARED_LIBRARIES := libreactconfig librrc_slider librrc_progressbar librrc_switch librrc_modal libyoga libglog libfb libfbjni libglog_init libfolly_json libfolly_futures libreact_render_mounting libreactnativeutilsjni libreact_utils libreact_render_debug libreact_render_graphics libreact_render_core react_render_componentregistry librrc_view librrc_unimplementedview librrc_root librrc_scrollview libbetter libreact_render_attributedstring libreact_render_uimanager libreact_render_templateprocessor libreact_render_scheduler libreact_render_animations libreact_render_imagemanager libreact_render_textlayoutmanager libreact_codegen_rncore rrc_text librrc_image librrc_textinput libreact_debug libreact_render_mapbuffer libmapbufferjni libreact_render_telemetry LOCAL_STATIC_LIBRARIES := @@ -43,7 +43,6 @@ $(call import-module,react/renderer/core) $(call import-module,react/renderer/components/image) $(call import-module,react/renderer/components/modal) $(call import-module,react/renderer/components/root) -$(call import-module,react/renderer/components/picker) $(call import-module,react/renderer/components/progressbar) $(call import-module,react/renderer/components/scrollview) $(call import-module,react/renderer/components/slider) diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK index 26a8474dd0c46d..e45bf4618f2f56 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK @@ -47,7 +47,6 @@ rn_xplat_cxx_library( "//xplat/js/react-native-github:generated_components-rncore", react_native_xplat_target("react/renderer/components/image:image"), react_native_xplat_target("react/renderer/components/modal:modal"), - react_native_xplat_target("react/renderer/components/picker:androidpicker"), react_native_xplat_target("react/renderer/components/slider:slider"), react_native_xplat_target("react/renderer/components/switch:androidswitch"), react_native_xplat_target("react/renderer/components/progressbar:androidprogressbar"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp index cd13e075b17c1d..f92c84d625c8a9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp @@ -12,8 +12,6 @@ #include #include -#include -#include #include #include #include @@ -71,10 +69,6 @@ CoreComponentsRegistry::sharedProviderRegistry() { concreteComponentDescriptorProvider()); providerRegistry->add(concreteComponentDescriptorProvider< AndroidDrawerLayoutComponentDescriptor>()); - providerRegistry->add(concreteComponentDescriptorProvider< - AndroidDialogPickerComponentDescriptor>()); - providerRegistry->add(concreteComponentDescriptorProvider< - AndroidDropdownPickerComponentDescriptor>()); return providerRegistry; }(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/shell/BUCK b/ReactAndroid/src/main/java/com/facebook/react/shell/BUCK index 7b44b22136b874..a5bb7403e8f6d5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/shell/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/shell/BUCK @@ -55,7 +55,6 @@ rn_android_library( react_native_target("java/com/facebook/react/views/drawer:drawer"), react_native_target("java/com/facebook/react/views/image:image"), react_native_target("java/com/facebook/react/views/modal:modal"), - react_native_target("java/com/facebook/react/views/picker:picker"), react_native_target("java/com/facebook/react/views/progressbar:progressbar"), react_native_target("java/com/facebook/react/views/scroll:scroll"), react_native_target("java/com/facebook/react/views/slider:slider"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java b/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java index 471ba0c833ec41..0dd8f31c54525c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java @@ -43,8 +43,6 @@ import com.facebook.react.views.drawer.ReactDrawerLayoutManager; import com.facebook.react.views.image.ReactImageManager; import com.facebook.react.views.modal.ReactModalHostManager; -import com.facebook.react.views.picker.ReactDialogPickerManager; -import com.facebook.react.views.picker.ReactDropdownPickerManager; import com.facebook.react.views.progressbar.ReactProgressBarViewManager; import com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager; import com.facebook.react.views.scroll.ReactHorizontalScrollViewManager; @@ -160,9 +158,7 @@ public MainReactPackage(MainPackageConfig config) { public List createViewManagers(ReactApplicationContext reactContext) { List viewManagers = new ArrayList<>(); - viewManagers.add(new ReactDialogPickerManager()); viewManagers.add(new ReactDrawerLayoutManager()); - viewManagers.add(new ReactDropdownPickerManager()); viewManagers.add(new ReactHorizontalScrollViewManager()); viewManagers.add(new ReactHorizontalScrollContainerViewManager()); viewManagers.add(new ReactProgressBarViewManager()); diff --git a/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDialogPickerManagerDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDialogPickerManagerDelegate.java deleted file mode 100644 index 8147f55a3d5110..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDialogPickerManagerDelegate.java +++ /dev/null @@ -1,48 +0,0 @@ -/** -* Copyright (c) Facebook, Inc. and its affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaDelegate.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; -import com.facebook.react.uimanager.LayoutShadowNode; - -public class AndroidDialogPickerManagerDelegate & AndroidDialogPickerManagerInterface> extends BaseViewManagerDelegate { - public AndroidDialogPickerManagerDelegate(U viewManager) { - super(viewManager); - } - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - switch (propName) { - case "color": - mViewManager.setColor(view, value == null ? null : ((Double) value).intValue()); - break; - case "backgroundColor": - mViewManager.setBackgroundColor(view, value == null ? null : ((Double) value).intValue()); - break; - case "enabled": - mViewManager.setEnabled(view, value == null ? true : (boolean) value); - break; - case "items": - mViewManager.setItems(view, (ReadableArray) value); - break; - case "prompt": - mViewManager.setPrompt(view, value == null ? "" : (String) value); - break; - case "selected": - mViewManager.setSelected(view, value == null ? 0 : ((Double) value).intValue()); - break; - default: - super.setProperty(view, propName, value); - } - } -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDialogPickerManagerInterface.java b/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDialogPickerManagerInterface.java deleted file mode 100644 index fe8986fa6cbaf9..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDialogPickerManagerInterface.java +++ /dev/null @@ -1,23 +0,0 @@ -/** -* Copyright (c) Facebook, Inc. and its affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.bridge.ReadableArray; - -public interface AndroidDialogPickerManagerInterface { - void setColor(T view, @Nullable Integer value); - void setBackgroundColor(T view, @Nullable Integer value); - void setEnabled(T view, boolean value); - void setItems(T view, @Nullable ReadableArray value); - void setPrompt(T view, @Nullable String value); - void setSelected(T view, int value); -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDropdownPickerManagerDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDropdownPickerManagerDelegate.java deleted file mode 100644 index c14ce248b59faf..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDropdownPickerManagerDelegate.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - *

This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. - * - * @generated by codegen project: GeneratePropsJavaDelegate.js - */ -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.uimanager.BaseViewManagerDelegate; -import com.facebook.react.uimanager.BaseViewManagerInterface; -import com.facebook.react.uimanager.LayoutShadowNode; - -public class AndroidDropdownPickerManagerDelegate< - T extends View, - U extends BaseViewManagerInterface & AndroidDropdownPickerManagerInterface> - extends BaseViewManagerDelegate { - public AndroidDropdownPickerManagerDelegate(U viewManager) { - super(viewManager); - } - - @Override - public void setProperty(T view, String propName, @Nullable Object value) { - switch (propName) { - case "color": - mViewManager.setColor(view, value == null ? null : ((Double) value).intValue()); - break; - case "enabled": - mViewManager.setEnabled(view, value == null ? true : (boolean) value); - break; - case "items": - mViewManager.setItems(view, (ReadableArray) value); - break; - case "prompt": - mViewManager.setPrompt(view, value == null ? "" : (String) value); - break; - case "selected": - mViewManager.setSelected(view, value == null ? 0 : ((Double) value).intValue()); - break; - default: - super.setProperty(view, propName, value); - } - } -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDropdownPickerManagerInterface.java b/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDropdownPickerManagerInterface.java deleted file mode 100644 index db599a79056442..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/viewmanagers/AndroidDropdownPickerManagerInterface.java +++ /dev/null @@ -1,22 +0,0 @@ -/** -* Copyright (c) Facebook, Inc. and its affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -* @generated by codegen project: GeneratePropsJavaInterface.js -*/ - -package com.facebook.react.viewmanagers; - -import android.view.View; -import androidx.annotation.Nullable; -import com.facebook.react.bridge.ReadableArray; - -public interface AndroidDropdownPickerManagerInterface { - void setColor(T view, @Nullable Integer value); - void setEnabled(T view, boolean value); - void setItems(T view, @Nullable ReadableArray value); - void setPrompt(T view, @Nullable String value); - void setSelected(T view, int value); -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/picker/BUCK b/ReactAndroid/src/main/java/com/facebook/react/views/picker/BUCK deleted file mode 100644 index 3cc6179ada7bb7..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/views/picker/BUCK +++ /dev/null @@ -1,30 +0,0 @@ -load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "react_native_target", "rn_android_library") - -rn_android_library( - name = "picker", - srcs = glob(["**/*.java"]), - autoglob = False, - is_androidx = True, - labels = ["supermodule:xplat/default/public.react_native.infra"], - provided_deps = [ - react_native_dep("third-party/android/androidx:annotation"), - react_native_dep("third-party/android/androidx:appcompat"), - react_native_dep("third-party/android/androidx:core"), - react_native_dep("third-party/android/androidx:fragment"), - react_native_dep("third-party/android/androidx:legacy-support-core-ui"), - react_native_dep("third-party/android/androidx:legacy-support-core-utils"), - ], - visibility = [ - "PUBLIC", - ], - deps = [ - react_native_dep("third-party/java/infer-annotations:infer-annotations"), - react_native_dep("third-party/java/jsr-305:jsr-305"), - react_native_target("java/com/facebook/react/bridge:bridge"), - react_native_target("java/com/facebook/react/common:common"), - react_native_target("java/com/facebook/react/module/annotations:annotations"), - react_native_target("java/com/facebook/react/uimanager:uimanager"), - react_native_target("java/com/facebook/react/uimanager/annotations:annotations"), - react_native_target("java/com/facebook/react/viewmanagers:viewmanagers"), - ], -) diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactDialogPickerManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactDialogPickerManager.java deleted file mode 100644 index 133dadf57a3811..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactDialogPickerManager.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.picker; - -import android.widget.Spinner; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.facebook.react.module.annotations.ReactModule; -import com.facebook.react.uimanager.ThemedReactContext; -import com.facebook.react.uimanager.ViewManagerDelegate; -import com.facebook.react.viewmanagers.AndroidDialogPickerManagerDelegate; -import com.facebook.react.viewmanagers.AndroidDialogPickerManagerInterface; - -/** {@link ReactPickerManager} for {@link ReactPicker} with {@link Spinner#MODE_DIALOG}. */ -@ReactModule(name = ReactDialogPickerManager.REACT_CLASS) -public class ReactDialogPickerManager extends ReactPickerManager - implements AndroidDialogPickerManagerInterface { - - public static final String REACT_CLASS = "AndroidDialogPicker"; - - private final ViewManagerDelegate mDelegate; - - public ReactDialogPickerManager() { - mDelegate = new AndroidDialogPickerManagerDelegate<>(this); - } - - @Override - public String getName() { - return REACT_CLASS; - } - - @Override - protected ReactPicker createViewInstance(ThemedReactContext reactContext) { - return new ReactPicker(reactContext, Spinner.MODE_DIALOG); - } - - @Override - protected ViewManagerDelegate getDelegate() { - return mDelegate; - } - - @Override - public void setBackgroundColor(@NonNull ReactPicker view, @Nullable Integer backgroundColor) { - view.setStagedBackgroundColor(backgroundColor); - } -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactDropdownPickerManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactDropdownPickerManager.java deleted file mode 100644 index 04b3f3d341d69d..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactDropdownPickerManager.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.picker; - -import android.widget.Spinner; -import androidx.annotation.NonNull; -import com.facebook.react.module.annotations.ReactModule; -import com.facebook.react.uimanager.ThemedReactContext; -import com.facebook.react.uimanager.ViewManagerDelegate; -import com.facebook.react.viewmanagers.AndroidDropdownPickerManagerDelegate; -import com.facebook.react.viewmanagers.AndroidDropdownPickerManagerInterface; - -/** {@link ReactPickerManager} for {@link ReactPicker} with {@link Spinner#MODE_DROPDOWN}. */ -@ReactModule(name = ReactDropdownPickerManager.REACT_CLASS) -public class ReactDropdownPickerManager extends ReactPickerManager - implements AndroidDropdownPickerManagerInterface { - - public static final String REACT_CLASS = "AndroidDropdownPicker"; - - private final ViewManagerDelegate mDelegate; - - public ReactDropdownPickerManager() { - mDelegate = new AndroidDropdownPickerManagerDelegate<>(this); - } - - @Override - public String getName() { - return REACT_CLASS; - } - - @Override - protected ReactPicker createViewInstance(ThemedReactContext reactContext) { - return new ReactPicker(reactContext, Spinner.MODE_DROPDOWN); - } - - @Override - protected ViewManagerDelegate getDelegate() { - return mDelegate; - } - - @Override - public void setBackgroundColor(@NonNull ReactPicker view, int backgroundColor) { - view.setStagedBackgroundColor(backgroundColor); - } -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPicker.java b/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPicker.java deleted file mode 100644 index 8eff2dd4f7bf26..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPicker.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.picker; - -import android.content.Context; -import android.content.res.ColorStateList; -import android.util.AttributeSet; -import android.view.View; -import android.widget.AdapterView; -import android.widget.Spinner; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.AppCompatSpinner; -import androidx.core.view.ViewCompat; -import com.facebook.react.common.annotations.VisibleForTesting; -import java.util.List; - -public class ReactPicker extends AppCompatSpinner { - - private int mMode = Spinner.MODE_DIALOG; - private @Nullable OnSelectListener mOnSelectListener; - private @Nullable List mItems; - private @Nullable List mStagedItems; - private @Nullable Integer mStagedSelection; - private @Nullable Integer mStagedPrimaryTextColor; - private @Nullable Integer mStagedBackgroundColor; - - private final OnItemSelectedListener mItemSelectedListener = - new OnItemSelectedListener() { - @Override - public void onItemSelected(AdapterView parent, View view, int position, long id) { - if (mOnSelectListener != null) { - mOnSelectListener.onItemSelected(position); - } - } - - @Override - public void onNothingSelected(AdapterView parent) { - if (mOnSelectListener != null) { - mOnSelectListener.onItemSelected(-1); - } - } - }; - - /** Listener interface for ReactPicker events. */ - public interface OnSelectListener { - void onItemSelected(int position); - } - - public ReactPicker(Context context) { - super(context); - } - - public ReactPicker(Context context, int mode) { - super(context, mode); - mMode = mode; - } - - public ReactPicker(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public ReactPicker(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - public ReactPicker(Context context, AttributeSet attrs, int defStyle, int mode) { - super(context, attrs, defStyle, mode); - mMode = mode; - } - - private final Runnable measureAndLayout = - new Runnable() { - @Override - public void run() { - measure( - MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY), - MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY)); - layout(getLeft(), getTop(), getRight(), getBottom()); - } - }; - - @Override - public void requestLayout() { - super.requestLayout(); - - // The spinner relies on a measure + layout pass happening after it calls requestLayout(). - // Without this, the widget never actually changes the selection and doesn't call the - // appropriate listeners. Since we override onLayout in our ViewGroups, a layout pass never - // happens after a call to requestLayout, so we simulate one here. - post(measureAndLayout); - } - - @Override - protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - super.onLayout(changed, left, top, right, bottom); - - // onItemSelected gets fired immediately after layout because checkSelectionChanged() in - // AdapterView updates the selection position from the default INVALID_POSITION. - // To match iOS behavior, which no onItemSelected during initial layout. - // We setup the listener after layout. - if (getOnItemSelectedListener() == null) setOnItemSelectedListener(mItemSelectedListener); - } - - public void setOnSelectListener(@Nullable OnSelectListener onSelectListener) { - mOnSelectListener = onSelectListener; - } - - @Nullable - public OnSelectListener getOnSelectListener() { - return mOnSelectListener; - } - - /* package */ void setStagedItems(final @Nullable List items) { - mStagedItems = items; - } - - /** - * Will cache "selection" value locally and set it only once {@link #commitStagedData} is called - */ - /* package */ void setStagedSelection(int selection) { - mStagedSelection = selection; - } - - /** Will set the "selection" value immediately as opposed to {@link #setStagedSelection(int)} */ - /* package */ void setImmediateSelection(int selection) { - if (selection != getSelectedItemPosition()) { - setOnItemSelectedListener(null); - setSelection(selection, false); - setOnItemSelectedListener(mItemSelectedListener); - } - } - - /* package */ void setStagedPrimaryTextColor(@Nullable Integer primaryColor) { - mStagedPrimaryTextColor = primaryColor; - } - - /* package */ void setStagedBackgroundColor(@Nullable Integer backgroundColor) { - mStagedBackgroundColor = backgroundColor; - } - - /** - * Used to commit staged data into ReactPicker view. During this period, we will disable {@link - * OnSelectListener#onItemSelected(int)} temporarily, so we don't get an event when changing the - * items/selection ourselves. - */ - /* package */ void commitStagedData() { - setOnItemSelectedListener(null); - - ReactPickerAdapter adapter = (ReactPickerAdapter) getAdapter(); - final int origSelection = getSelectedItemPosition(); - if (mStagedItems != null && mStagedItems != mItems) { - mItems = mStagedItems; - mStagedItems = null; - if (adapter == null) { - adapter = new ReactPickerAdapter(getContext(), mItems); - setAdapter(adapter); - } else { - adapter.clear(); - adapter.addAll(mItems); - adapter.notifyDataSetChanged(); - } - } - - if (mStagedSelection != null && mStagedSelection != origSelection) { - setSelection(mStagedSelection, false); - mStagedSelection = null; - } - - if (mStagedPrimaryTextColor != null - && adapter != null - && mStagedPrimaryTextColor != adapter.getPrimaryTextColor()) { - adapter.setPrimaryTextColor(mStagedPrimaryTextColor); - ViewCompat.setBackgroundTintList(this, ColorStateList.valueOf(mStagedPrimaryTextColor)); - mStagedPrimaryTextColor = null; - } - - if (mStagedBackgroundColor != null - && adapter != null - && mStagedBackgroundColor != adapter.getBackgroundColor()) { - adapter.setBackgroundColor(mStagedBackgroundColor); - mStagedBackgroundColor = null; - } - - setOnItemSelectedListener(mItemSelectedListener); - } - - @VisibleForTesting - public int getMode() { - return mMode; - } -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerAdapter.java b/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerAdapter.java deleted file mode 100644 index 4f2890e79158c2..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerAdapter.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.picker; - -import android.content.Context; -import android.content.res.ColorStateList; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.TextView; -import androidx.annotation.Nullable; -import com.facebook.infer.annotation.Assertions; -import java.util.List; - -/* package */ -class ReactPickerAdapter extends ArrayAdapter { - - private final LayoutInflater mInflater; - private @Nullable Integer mPrimaryTextColor; - private @Nullable Integer mBackgroundColor; - - public ReactPickerAdapter(Context context, List data) { - super(context, 0, data); - - mInflater = - (LayoutInflater) - Assertions.assertNotNull(context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)); - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - return getView(position, convertView, parent, false); - } - - @Override - public View getDropDownView(int position, View convertView, ViewGroup parent) { - return getView(position, convertView, parent, true); - } - - private View getView(int position, View convertView, ViewGroup parent, boolean isDropdown) { - ReactPickerItem item = getItem(position); - boolean isNew = false; - if (convertView == null) { - int layoutResId = - isDropdown - ? android.R.layout.simple_spinner_dropdown_item - : android.R.layout.simple_spinner_item; - convertView = mInflater.inflate(layoutResId, parent, false); - // Save original text colors - convertView.setTag(((TextView) convertView).getTextColors()); - isNew = true; - } - - TextView textView = (TextView) convertView; - textView.setText(item.label); - if (!isDropdown && mPrimaryTextColor != null) { - textView.setTextColor(mPrimaryTextColor); - } else if (item.color != null) { - textView.setTextColor(item.color); - } else if (textView.getTag() != null && !isNew) { - // In case the new item does not set the color prop, go back to the default one - textView.setTextColor((ColorStateList) textView.getTag()); - } - - if (mBackgroundColor != null) { - textView.setBackgroundColor(mBackgroundColor); - } - - return textView; - } - - public @Nullable Integer getPrimaryTextColor() { - return mPrimaryTextColor; - } - - public @Nullable Integer getBackgroundColor() { - return mBackgroundColor; - } - - public void setPrimaryTextColor(@Nullable Integer primaryTextColor) { - mPrimaryTextColor = primaryTextColor; - notifyDataSetChanged(); - } - - public void setBackgroundColor(@Nullable Integer backgroundColor) { - mBackgroundColor = backgroundColor; - notifyDataSetChanged(); - } -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerItem.java b/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerItem.java deleted file mode 100644 index 733deb3907022c..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerItem.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.picker; - -import androidx.annotation.Nullable; -import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.bridge.ReadableMap; -import java.util.ArrayList; -import java.util.List; - -/* package */ -class ReactPickerItem { - public final String label; - @Nullable public final Integer color; - - public ReactPickerItem(final ReadableMap jsMapData) { - label = jsMapData.getString("label"); - - if (jsMapData.hasKey("color") && !jsMapData.isNull("color")) { - color = jsMapData.getInt("color"); - } else { - color = null; - } - } - - @Nullable - public static List createFromJsArrayMap(final ReadableArray jsArrayMap) { - if (jsArrayMap == null) { - return null; - } - - final List items = new ArrayList<>(jsArrayMap.size()); - for (int i = 0; i < jsArrayMap.size(); ++i) { - items.add(new ReactPickerItem(jsArrayMap.getMap(i))); - } - return items; - } -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerManager.java deleted file mode 100644 index 3927dc86d37e03..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/views/picker/ReactPickerManager.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.picker; - -import android.widget.Spinner; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.uimanager.SimpleViewManager; -import com.facebook.react.uimanager.ThemedReactContext; -import com.facebook.react.uimanager.UIManagerHelper; -import com.facebook.react.uimanager.ViewProps; -import com.facebook.react.uimanager.annotations.ReactProp; -import com.facebook.react.uimanager.events.EventDispatcher; -import com.facebook.react.views.picker.events.PickerItemSelectEvent; -import java.util.List; - -/** - * {@link ViewManager} for the {@link ReactPicker} view. This is abstract because the {@link - * Spinner} doesn't support setting the mode (dropdown/dialog) outside the constructor, so that is - * delegated to the separate {@link ReactDropdownPickerManager} and {@link ReactDialogPickerManager} - * components. These are merged back on the JS side into one React component. - */ -public abstract class ReactPickerManager extends SimpleViewManager { - - @ReactProp(name = "items") - public void setItems(ReactPicker view, @Nullable ReadableArray items) { - final List pickerItems = ReactPickerItem.createFromJsArrayMap(items); - view.setStagedItems(pickerItems); - } - - @ReactProp(name = ViewProps.COLOR, customType = "Color") - public void setColor(ReactPicker view, @Nullable Integer color) { - view.setStagedPrimaryTextColor(color); - } - - @ReactProp(name = "prompt") - public void setPrompt(ReactPicker view, @Nullable String prompt) { - view.setPrompt(prompt); - } - - @ReactProp(name = ViewProps.ENABLED, defaultBoolean = true) - public void setEnabled(ReactPicker view, boolean enabled) { - view.setEnabled(enabled); - } - - @ReactProp(name = "selected") - public void setSelected(ReactPicker view, int selected) { - view.setStagedSelection(selected); - } - - @Override - protected void onAfterUpdateTransaction(ReactPicker view) { - super.onAfterUpdateTransaction(view); - view.commitStagedData(); - } - - @Override - protected void addEventEmitters(final ThemedReactContext reactContext, final ReactPicker picker) { - picker.setOnSelectListener( - new PickerEventEmitter( - picker, UIManagerHelper.getEventDispatcherForReactTag(reactContext, picker.getId()))); - } - - @Override - public void receiveCommand( - @NonNull ReactPicker view, String commandId, @Nullable ReadableArray args) { - switch (commandId) { - case "setNativeSelectedPosition": - if (args != null) { - view.setImmediateSelection(args.getInt(0)); - break; - } - } - } - - private static class PickerEventEmitter implements ReactPicker.OnSelectListener { - - private final ReactPicker mReactPicker; - private final EventDispatcher mEventDispatcher; - - public PickerEventEmitter(ReactPicker reactPicker, EventDispatcher eventDispatcher) { - mReactPicker = reactPicker; - mEventDispatcher = eventDispatcher; - } - - @Override - public void onItemSelected(int position) { - mEventDispatcher.dispatchEvent( - new PickerItemSelectEvent( - UIManagerHelper.getSurfaceId(mReactPicker), mReactPicker.getId(), position)); - } - } -} diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/picker/events/PickerItemSelectEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/picker/events/PickerItemSelectEvent.java deleted file mode 100644 index 445b0cbec38849..00000000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/views/picker/events/PickerItemSelectEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.views.picker.events; - -import androidx.annotation.Nullable; -import com.facebook.react.bridge.Arguments; -import com.facebook.react.bridge.WritableMap; -import com.facebook.react.uimanager.events.Event; - -public class PickerItemSelectEvent extends Event { - public static final String EVENT_NAME = "topSelect"; - - private final int mPosition; - - @Deprecated - public PickerItemSelectEvent(int reactTag, int position) { - this(-1, reactTag, position); - } - - public PickerItemSelectEvent(int surfaceId, int reactTag, int position) { - super(surfaceId, reactTag); - mPosition = position; - } - - @Override - public String getEventName() { - return EVENT_NAME; - } - - @Nullable - @Override - protected WritableMap getEventData() { - WritableMap eventData = Arguments.createMap(); - eventData.putInt("position", mPosition); - return eventData; - } -} diff --git a/ReactCommon/react/renderer/components/picker/Android.mk b/ReactCommon/react/renderer/components/picker/Android.mk deleted file mode 100644 index 0a3b64d7bc2aae..00000000000000 --- a/ReactCommon/react/renderer/components/picker/Android.mk +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := rrc_picker - -LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/androidpicker/react/renderer/components/androidpicker/*.cpp) - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/androidpicker/react/renderer/components/androidpicker/ -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/androidpicker/ - -LOCAL_CFLAGS := \ - -DLOG_TAG=\"Fabric\" - -LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall - -LOCAL_STATIC_LIBRARIES := - -LOCAL_SHARED_LIBRARIES := libyoga glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics libreact_render_uimanager librrc_view libreact_render_componentregistry libreact_codegen_rncore libreact_debug - -include $(BUILD_SHARED_LIBRARY) - -$(call import-module,glog) -$(call import-module,folly) -$(call import-module,fbgloginit) -$(call import-module,react/renderer/core) -$(call import-module,react/renderer/componentregistry) -$(call import-module,react/renderer/debug) -$(call import-module,react/renderer/graphics) -$(call import-module,react/renderer/uimanager) -$(call import-module,react/renderer/components/view) -$(call import-module,yogajni) diff --git a/ReactCommon/react/renderer/components/picker/BUCK b/ReactCommon/react/renderer/components/picker/BUCK deleted file mode 100644 index 566c0ad4d1ee0e..00000000000000 --- a/ReactCommon/react/renderer/components/picker/BUCK +++ /dev/null @@ -1,98 +0,0 @@ -load( - "//tools/build_defs/oss:rn_defs.bzl", - "ANDROID", - "APPLE", - "CXX", - "YOGA_CXX_TARGET", - "fb_xplat_cxx_test", - "get_apple_compiler_flags", - "get_apple_inspector_flags", - "get_preprocessor_flags_for_build_mode", - "react_native_target", - "react_native_xplat_target", - "rn_xplat_cxx_library", - "subdir_glob", -) - -APPLE_COMPILER_FLAGS = get_apple_compiler_flags() - -rn_xplat_cxx_library( - name = "androidpicker", - srcs = glob( - ["androidpicker/**/*.cpp"], - exclude = glob(["tests/**/*.cpp"]), - ), - headers = glob( - ["androidpicker/**/*.h"], - exclude = glob(["tests/**/*.h"]), - ), - header_namespace = "", - exported_headers = subdir_glob( - [ - ("", "*.h"), - ("androidpicker/react/renderer/components/androidpicker", "*.h"), - ], - prefix = "react/renderer/components/androidpicker", - ), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++17", - "-Wall", - ], - cxx_tests = [":tests"], - fbandroid_deps = [ - react_native_target("jni/react/jni:jni"), - ], - fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, - fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), - force_static = True, - labels = ["supermodule:xplat/default/public.react_native.infra"], - platforms = (ANDROID, APPLE, CXX), - preprocessor_flags = [ - "-DLOG_TAG=\"ReactNative\"", - "-DWITH_FBSYSTRACE=1", - ], - visibility = ["PUBLIC"], - deps = [ - "//third-party/glog:glog", - "//xplat/fbsystrace:fbsystrace", - "//xplat/folly:headers_only", - "//xplat/folly:memory", - "//xplat/folly:molly", - YOGA_CXX_TARGET, - react_native_xplat_target("react/renderer/debug:debug"), - react_native_xplat_target("react/renderer/core:core"), - react_native_xplat_target("react/renderer/graphics:graphics"), - react_native_xplat_target("react/renderer/components/view:view"), - react_native_xplat_target("react/renderer/uimanager:uimanager"), - react_native_xplat_target("react/renderer/componentregistry:componentregistry"), - "//xplat/js/react-native-github:generated_components-rncore", - ], -) - -fb_xplat_cxx_test( - name = "tests", - srcs = glob(["tests/**/*.cpp"]), - headers = glob(["tests/**/*.h"]), - compiler_flags = [ - "-fexceptions", - "-frtti", - "-std=c++17", - "-Wall", - ], - contacts = ["oncall+react_native@xmail.facebook.com"], - platforms = ( - # `Apple` and `Android` flavors are disabled because the module depends on `textlayoutmanager` which requires real an Emulator/Simulator to run. - # At the same time, the code of tests does not rely on the simulator capabilities and it would be wasteful to add `fbandroid_use_instrumentation_test = True`. - # (Beware of this option though.) - # ANDROID, - # APPLE, - CXX - ), - deps = [ - ":androidpicker", - "//xplat/folly:molly", - "//xplat/third-party/gmock:gtest", - ], -) diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerComponentDescriptor.h b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerComponentDescriptor.h deleted file mode 100644 index 0c5622241fca7a..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerComponentDescriptor.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include "AndroidDialogPickerShadowNode.h" - -#include - -namespace facebook { -namespace react { - -using AndroidDialogPickerComponentDescriptor = - ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerEventEmitter.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerEventEmitter.cpp deleted file mode 100644 index 983a7f5dfffaff..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerEventEmitter.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "AndroidDialogPickerEventEmitter.h" - -namespace facebook { -namespace react { - -void AndroidDialogPickerEventEmitter::onSelect( - AndroidDialogPickerOnSelectStruct event) const { - dispatchEvent("select", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "position", event.position); - return payload; - }); -} - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerEventEmitter.h b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerEventEmitter.h deleted file mode 100644 index 37781f4b5a8e5e..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerEventEmitter.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -struct AndroidDialogPickerOnSelectStruct { - int position; -}; - -class AndroidDialogPickerEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - void onSelect(AndroidDialogPickerOnSelectStruct value) const; -}; - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerProps.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerProps.cpp deleted file mode 100644 index c44238843b03e2..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerProps.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "AndroidDialogPickerProps.h" - -#include -#include - -namespace facebook { -namespace react { - -AndroidDialogPickerProps::AndroidDialogPickerProps( - const AndroidDialogPickerProps &sourceProps, - const RawProps &rawProps) - : ViewProps(sourceProps, rawProps), - color(convertRawProp(rawProps, "color", sourceProps.color, {})), - enabled(convertRawProp(rawProps, "enabled", sourceProps.enabled, {true})), - items(convertRawProp(rawProps, "items", sourceProps.items, {})), - prompt(convertRawProp(rawProps, "prompt", sourceProps.prompt, {""})), - selected( - convertRawProp(rawProps, "selected", sourceProps.selected, {0})) {} - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerProps.h b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerProps.h deleted file mode 100644 index e4868a7f67633a..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerProps.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -struct AndroidDialogPickerItemsStruct { - std::string label; - int color; -}; - -static inline void fromRawValue( - const RawValue &value, - AndroidDialogPickerItemsStruct &result) { - auto map = (better::map)value; - - auto label = map.find("label"); - if (label != map.end()) { - fromRawValue(label->second, result.label); - } - auto color = map.find("color"); - // C++ props are not used on Android at the moment, so we can leave - // result.color uninitialized if the JS prop has a null value. TODO: revisit - // this once we start using C++ props on Android. - if (color != map.end() && color->second.hasValue()) { - fromRawValue(color->second, result.color); - } -} - -static inline std::string toString( - const AndroidDialogPickerItemsStruct &value) { - return "[Object AndroidDialogPickerItemsStruct]"; -} - -static inline void fromRawValue( - const RawValue &value, - std::vector &result) { - auto items = (std::vector)value; - for (const auto &item : items) { - AndroidDialogPickerItemsStruct newItem; - fromRawValue(item, newItem); - result.emplace_back(newItem); - } -} - -class AndroidDialogPickerProps final : public ViewProps { - public: - AndroidDialogPickerProps() = default; - - AndroidDialogPickerProps( - const AndroidDialogPickerProps &sourceProps, - const RawProps &rawProps); - -#pragma mark - Props - - const SharedColor color{}; - const bool enabled{true}; - const std::vector items{}; - const std::string prompt{""}; - const int selected{0}; -}; - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerShadowNode.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerShadowNode.cpp deleted file mode 100644 index e101c71b022914..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerShadowNode.cpp +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "AndroidDialogPickerShadowNode.h" - -namespace facebook { -namespace react { - -extern const char AndroidDialogPickerComponentName[] = "AndroidDialogPicker"; - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerShadowNode.h b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerShadowNode.h deleted file mode 100644 index e819b923e80a60..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDialogPickerShadowNode.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include "AndroidDialogPickerEventEmitter.h" -#include "AndroidDialogPickerProps.h" - -#include - -namespace facebook { -namespace react { - -extern const char AndroidDialogPickerComponentName[]; - -/* - * `ShadowNode` for component. - */ -using AndroidDialogPickerShadowNode = ConcreteViewShadowNode< - AndroidDialogPickerComponentName, - AndroidDialogPickerProps, - AndroidDialogPickerEventEmitter>; - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerComponentDescriptor.h b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerComponentDescriptor.h deleted file mode 100644 index cbad671add261c..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerComponentDescriptor.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include "AndroidDropdownPickerShadowNode.h" - -#include - -namespace facebook { -namespace react { - -using AndroidDropdownPickerComponentDescriptor = - ConcreteComponentDescriptor; - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerEventEmitter.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerEventEmitter.cpp deleted file mode 100644 index df52918bac4ef9..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerEventEmitter.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "AndroidDropdownPickerEventEmitter.h" - -namespace facebook { -namespace react { - -void AndroidDropdownPickerEventEmitter::onSelect( - AndroidDropdownPickerOnSelectStruct event) const { - dispatchEvent("select", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "position", event.position); - return payload; - }); -} - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerEventEmitter.h b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerEventEmitter.h deleted file mode 100644 index 356203b1c6edf0..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerEventEmitter.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -namespace facebook { -namespace react { - -struct AndroidDropdownPickerOnSelectStruct { - int position; -}; - -class AndroidDropdownPickerEventEmitter : public ViewEventEmitter { - public: - using ViewEventEmitter::ViewEventEmitter; - - void onSelect(AndroidDropdownPickerOnSelectStruct value) const; -}; - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerProps.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerProps.cpp deleted file mode 100644 index b305b024210690..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerProps.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "AndroidDropdownPickerProps.h" - -#include -#include - -namespace facebook { -namespace react { - -AndroidDropdownPickerProps::AndroidDropdownPickerProps( - const AndroidDropdownPickerProps &sourceProps, - const RawProps &rawProps) - : ViewProps(sourceProps, rawProps), - color(convertRawProp(rawProps, "color", sourceProps.color, {})), - enabled(convertRawProp(rawProps, "enabled", sourceProps.enabled, {true})), - items(convertRawProp(rawProps, "items", sourceProps.items, {})), - prompt(convertRawProp(rawProps, "prompt", sourceProps.prompt, {""})), - selected( - convertRawProp(rawProps, "selected", sourceProps.selected, {0})) {} - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerProps.h b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerProps.h deleted file mode 100644 index 3e66603c4ee7b8..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerProps.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace facebook { -namespace react { - -struct AndroidDropdownPickerItemsStruct { - std::string label; - int color; -}; - -static inline void fromRawValue( - const RawValue &value, - AndroidDropdownPickerItemsStruct &result) { - auto map = (better::map)value; - - auto label = map.find("label"); - if (label != map.end()) { - fromRawValue(label->second, result.label); - } - auto color = map.find("color"); - // C++ props are not used on Android at the moment, so we can leave - // result.color uninitialized if the JS prop has a null value. TODO: revisit - // this once we start using C++ props on Android. - if (color != map.end() && color->second.hasValue()) { - fromRawValue(color->second, result.color); - } -} - -static inline std::string toString( - const AndroidDropdownPickerItemsStruct &value) { - return "[Object AndroidDropdownPickerItemsStruct]"; -} - -static inline void fromRawValue( - const RawValue &value, - std::vector &result) { - auto items = (std::vector)value; - for (const auto &item : items) { - AndroidDropdownPickerItemsStruct newItem; - fromRawValue(item, newItem); - result.emplace_back(newItem); - } -} - -class AndroidDropdownPickerProps final : public ViewProps { - public: - AndroidDropdownPickerProps() = default; - - AndroidDropdownPickerProps( - const AndroidDropdownPickerProps &sourceProps, - const RawProps &rawProps); - -#pragma mark - Props - - const SharedColor color{}; - const bool enabled{true}; - const std::vector items{}; - const std::string prompt{""}; - const int selected{0}; -}; - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerShadowNode.cpp b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerShadowNode.cpp deleted file mode 100644 index 724a2fde03e7e9..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerShadowNode.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "AndroidDropdownPickerShadowNode.h" - -namespace facebook { -namespace react { - -extern const char AndroidDropdownPickerComponentName[] = - "AndroidDropdownPicker"; - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerShadowNode.h b/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerShadowNode.h deleted file mode 100644 index 5c4ac182798c0f..00000000000000 --- a/ReactCommon/react/renderer/components/picker/androidpicker/react/renderer/components/androidpicker/AndroidDropdownPickerShadowNode.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include "AndroidDropdownPickerEventEmitter.h" -#include "AndroidDropdownPickerProps.h" - -#include - -namespace facebook { -namespace react { - -extern const char AndroidDropdownPickerComponentName[]; - -/* - * `ShadowNode` for component. - */ -using AndroidDropdownPickerShadowNode = ConcreteViewShadowNode< - AndroidDropdownPickerComponentName, - AndroidDropdownPickerProps, - AndroidDropdownPickerEventEmitter>; - -} // namespace react -} // namespace facebook