From 88ebdd478ead701dd511cbea16d625f05623c1b9 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Tue, 23 Jul 2024 07:42:36 -0700 Subject: [PATCH] Migrate com.facebook.react.views.progressbar to Kotlin (#45594) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45594 This moves all the remaining Java classes inside com.facebook.react.views.progressbar to Kotlin Changelog: [Internal] [Changed] - Migrate com.facebook.react.views.progressbar to Kotlin Reviewed By: tdn120 Differential Revision: D60108654 --- .../ReactAndroid/api/ReactAndroid.api | 20 +- .../progressbar/ProgressBarContainerView.java | 99 --------- .../progressbar/ProgressBarContainerView.kt | 70 ++++++ .../ReactProgressBarViewManager.java | 203 ------------------ .../ReactProgressBarViewManager.kt | 165 ++++++++++++++ 5 files changed, 248 insertions(+), 309 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.kt delete mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java create mode 100644 packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.kt diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 41906a233beb..d60bbbb9898d 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -6576,6 +6576,11 @@ public abstract interface class com/facebook/react/views/modal/ReactModalHostVie public abstract fun onRequestClose (Landroid/content/DialogInterface;)V } +public final class com/facebook/react/views/progressbar/ProgressBarContainerView : android/widget/FrameLayout { + public static final field MAX_PROGRESS I + public fun (Landroid/content/Context;)V +} + public final class com/facebook/react/views/progressbar/ProgressBarShadowNode : com/facebook/react/uimanager/LayoutShadowNode, com/facebook/yoga/YogaMeasureFunction { public fun ()V public final fun getStyle ()Ljava/lang/String; @@ -6590,20 +6595,17 @@ public class com/facebook/react/views/progressbar/ProgressBarShadowNode$$PropsSe public fun setProperty (Lcom/facebook/react/views/progressbar/ProgressBarShadowNode;Ljava/lang/String;Ljava/lang/Object;)V } -public class com/facebook/react/views/progressbar/ReactProgressBarViewManager : com/facebook/react/uimanager/BaseViewManager, com/facebook/react/viewmanagers/AndroidProgressBarManagerInterface { +public final class com/facebook/react/views/progressbar/ReactProgressBarViewManager : com/facebook/react/uimanager/BaseViewManager, com/facebook/react/viewmanagers/AndroidProgressBarManagerInterface { + public static final field Companion Lcom/facebook/react/views/progressbar/ReactProgressBarViewManager$Companion; public static final field REACT_CLASS Ljava/lang/String; public fun ()V - public static fun createProgressBar (Landroid/content/Context;I)Landroid/widget/ProgressBar; public synthetic fun createShadowNodeInstance ()Lcom/facebook/react/uimanager/ReactShadowNode; public fun createShadowNodeInstance ()Lcom/facebook/react/views/progressbar/ProgressBarShadowNode; - protected synthetic fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View; - protected fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Lcom/facebook/react/views/progressbar/ProgressBarContainerView; - protected fun getDelegate ()Lcom/facebook/react/uimanager/ViewManagerDelegate; + public synthetic fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View; public fun getName ()Ljava/lang/String; public fun getShadowNodeClass ()Ljava/lang/Class; public fun measure (Landroid/content/Context;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/ReadableMap;FLcom/facebook/yoga/YogaMeasureMode;FLcom/facebook/yoga/YogaMeasureMode;[F)J - protected synthetic fun onAfterUpdateTransaction (Landroid/view/View;)V - protected fun onAfterUpdateTransaction (Lcom/facebook/react/views/progressbar/ProgressBarContainerView;)V + public synthetic fun onAfterUpdateTransaction (Landroid/view/View;)V public synthetic fun setAnimating (Landroid/view/View;Z)V public fun setAnimating (Lcom/facebook/react/views/progressbar/ProgressBarContainerView;Z)V public synthetic fun setColor (Landroid/view/View;Ljava/lang/Integer;)V @@ -6629,6 +6631,10 @@ public class com/facebook/react/views/progressbar/ReactProgressBarViewManager$$P public fun setProperty (Lcom/facebook/react/views/progressbar/ReactProgressBarViewManager;Lcom/facebook/react/views/progressbar/ProgressBarContainerView;Ljava/lang/String;Ljava/lang/Object;)V } +public final class com/facebook/react/views/progressbar/ReactProgressBarViewManager$Companion { + public final fun createProgressBar (Landroid/content/Context;I)Landroid/widget/ProgressBar; +} + public abstract interface class com/facebook/react/views/scroll/FpsListener { public abstract fun disable (Ljava/lang/String;)V public abstract fun enable (Ljava/lang/String;)V diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.java deleted file mode 100644 index ca9eefcdafe6..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and 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.progressbar; - -import android.content.Context; -import android.graphics.PorterDuff; -import android.graphics.drawable.Drawable; -import android.view.View; -import android.view.ViewGroup; -import android.widget.FrameLayout; -import android.widget.ProgressBar; -import androidx.annotation.Nullable; -import com.facebook.infer.annotation.Nullsafe; -import com.facebook.react.bridge.JSApplicationIllegalArgumentException; - -/** - * Controls an enclosing ProgressBar. Exists so that the ProgressBar can be recreated if the style - * would change. - */ -/* package */ @Nullsafe(Nullsafe.Mode.LOCAL) -class ProgressBarContainerView extends FrameLayout { - private static final int MAX_PROGRESS = 1000; - - private @Nullable Integer mColor; - private boolean mIndeterminate = true; - private boolean mAnimating = true; - private double mProgress; - private @Nullable ProgressBar mProgressBar; - - public ProgressBarContainerView(Context context) { - super(context); - } - - public void setStyle(@Nullable String styleName) { - int style = ReactProgressBarViewManager.getStyleFromString(styleName); - mProgressBar = ReactProgressBarViewManager.createProgressBar(getContext(), style); - mProgressBar.setMax(MAX_PROGRESS); - removeAllViews(); - addView( - mProgressBar, - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); - } - - public void setColor(@Nullable Integer color) { - mColor = color; - } - - public void setIndeterminate(boolean indeterminate) { - mIndeterminate = indeterminate; - } - - public void setProgress(double progress) { - mProgress = progress; - } - - public void setAnimating(boolean animating) { - mAnimating = animating; - } - - public void apply() { - if (mProgressBar == null) { - throw new JSApplicationIllegalArgumentException("setStyle() not called"); - } - - mProgressBar.setIndeterminate(mIndeterminate); - setColor(mProgressBar); - mProgressBar.setProgress((int) (mProgress * MAX_PROGRESS)); - if (mAnimating) { - mProgressBar.setVisibility(View.VISIBLE); - } else { - mProgressBar.setVisibility(View.INVISIBLE); - } - } - - private void setColor(ProgressBar progressBar) { - Drawable drawable; - if (progressBar.isIndeterminate()) { - drawable = progressBar.getIndeterminateDrawable(); - } else { - drawable = progressBar.getProgressDrawable(); - } - - if (drawable == null) { - return; - } - - if (mColor != null) { - drawable.setColorFilter(mColor, PorterDuff.Mode.SRC_IN); - } else { - drawable.clearColorFilter(); - } - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.kt new file mode 100644 index 000000000000..c5531cc69fd9 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.kt @@ -0,0 +1,70 @@ +/* + * Copyright (c) Meta Platforms, Inc. and 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.progressbar + +import android.content.Context +import android.graphics.PorterDuff +import android.view.ViewGroup +import android.widget.FrameLayout +import android.widget.ProgressBar +import com.facebook.react.bridge.JSApplicationIllegalArgumentException + +/** + * Controls an enclosing [ProgressBar]. Exists so that the [ProgressBar] can be recreated if the + * style would change. + */ +public class ProgressBarContainerView(context: Context) : FrameLayout(context) { + + internal var color: Int? = null + internal var indeterminate = true + internal var animating = true + internal var progress = 0.0 + + private var progressBar: ProgressBar? = null + + internal fun apply() { + this.progressBar?.let { progressBar -> + progressBar.isIndeterminate = indeterminate + setColor(progressBar) + progressBar.progress = (progress * MAX_PROGRESS).toInt() + progressBar.visibility = if (animating) VISIBLE else INVISIBLE + } ?: throw JSApplicationIllegalArgumentException("setStyle() not called") + } + + internal fun setStyle(styleName: String?) { + val style = ReactProgressBarViewManager.getStyleFromString(styleName) + progressBar = + ReactProgressBarViewManager.createProgressBar(context, style).apply { max = MAX_PROGRESS } + removeAllViews() + addView( + progressBar, + ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)) + } + + private fun setColor(progressBar: ProgressBar) { + val drawable = + if (progressBar.isIndeterminate) { + progressBar.indeterminateDrawable + } else { + progressBar.progressDrawable + } + + if (drawable == null) { + return + } + + @Suppress("DEPRECATION") + color?.let { drawable.setColorFilter(it, PorterDuff.Mode.SRC_IN) } + ?: drawable.clearColorFilter() + } + + private companion object { + const val MAX_PROGRESS = 1000 + } +} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java deleted file mode 100644 index abe14eab0c3f..000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and 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.progressbar; - -import android.content.Context; -import android.util.Pair; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ProgressBar; -import androidx.annotation.Nullable; -import com.facebook.common.logging.FLog; -import com.facebook.infer.annotation.Nullsafe; -import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.common.ReactConstants; -import com.facebook.react.module.annotations.ReactModule; -import com.facebook.react.uimanager.BaseViewManager; -import com.facebook.react.uimanager.PixelUtil; -import com.facebook.react.uimanager.ThemedReactContext; -import com.facebook.react.uimanager.ViewManagerDelegate; -import com.facebook.react.uimanager.ViewProps; -import com.facebook.react.uimanager.annotations.ReactProp; -import com.facebook.react.viewmanagers.AndroidProgressBarManagerDelegate; -import com.facebook.react.viewmanagers.AndroidProgressBarManagerInterface; -import com.facebook.yoga.YogaMeasureMode; -import com.facebook.yoga.YogaMeasureOutput; -import java.util.WeakHashMap; - -/** - * Manages instances of ProgressBar. ProgressBar is wrapped in a ProgressBarContainerView because - * the style of the ProgressBar can only be set in the constructor; whenever the style of a - * ProgressBar changes, we have to drop the existing ProgressBar (if there is one) and create a new - * one with the style given. - */ -@Nullsafe(Nullsafe.Mode.LOCAL) -@ReactModule(name = ReactProgressBarViewManager.REACT_CLASS) -public class ReactProgressBarViewManager - extends BaseViewManager - implements AndroidProgressBarManagerInterface { - - public static final String REACT_CLASS = "AndroidProgressBar"; - - private final WeakHashMap> mMeasuredStyles = new WeakHashMap<>(); - - /* package */ static final String PROP_STYLE = "styleAttr"; - /* package */ static final String PROP_ATTR = "typeAttr"; - /* package */ static final String PROP_INDETERMINATE = "indeterminate"; - /* package */ static final String PROP_PROGRESS = "progress"; - /* package */ static final String PROP_ANIMATING = "animating"; - - /* package */ static final String DEFAULT_STYLE = "Normal"; - - private static Object sProgressBarCtorLock = new Object(); - - private final ViewManagerDelegate mDelegate; - - /** - * We create ProgressBars on both the UI and shadow threads. There is a race condition in the - * ProgressBar constructor that may cause crashes when two ProgressBars are constructed at the - * same time on two different threads. This static ctor wrapper protects against that. - */ - public static ProgressBar createProgressBar(Context context, int style) { - synchronized (sProgressBarCtorLock) { - return new ProgressBar(context, null, style); - } - } - - public ReactProgressBarViewManager() { - mDelegate = new AndroidProgressBarManagerDelegate<>(this); - } - - @Override - public String getName() { - return REACT_CLASS; - } - - @Override - protected ProgressBarContainerView createViewInstance(ThemedReactContext context) { - return new ProgressBarContainerView(context); - } - - @Override - @ReactProp(name = PROP_STYLE) - public void setStyleAttr(ProgressBarContainerView view, @Nullable String styleName) { - view.setStyle(styleName); - } - - @Override - @ReactProp(name = ViewProps.COLOR, customType = "Color") - public void setColor(ProgressBarContainerView view, @Nullable Integer color) { - view.setColor(color); - } - - @Override - @ReactProp(name = PROP_INDETERMINATE) - public void setIndeterminate(ProgressBarContainerView view, boolean indeterminate) { - view.setIndeterminate(indeterminate); - } - - @Override - @ReactProp(name = PROP_PROGRESS) - public void setProgress(ProgressBarContainerView view, double progress) { - view.setProgress(progress); - } - - @Override - @ReactProp(name = PROP_ANIMATING) - public void setAnimating(ProgressBarContainerView view, boolean animating) { - view.setAnimating(animating); - } - - @Override - public void setTestID(ProgressBarContainerView view, @Nullable String value) { - super.setTestId(view, value); - } - - @Override - @ReactProp(name = PROP_ATTR) - public void setTypeAttr(ProgressBarContainerView view, @Nullable String value) {} - - @Override - public ProgressBarShadowNode createShadowNodeInstance() { - return new ProgressBarShadowNode(); - } - - @Override - public Class getShadowNodeClass() { - return ProgressBarShadowNode.class; - } - - @Override - public void updateExtraData(ProgressBarContainerView root, Object extraData) { - // do nothing - } - - @Override - protected void onAfterUpdateTransaction(ProgressBarContainerView view) { - view.apply(); - } - - @Override - protected ViewManagerDelegate getDelegate() { - return mDelegate; - } - - /* package */ static int getStyleFromString(@Nullable String styleStr) { - if (styleStr == null) { - FLog.w(ReactConstants.TAG, "ProgressBar needs to have a style, null received"); - return android.R.attr.progressBarStyle; - } else if (styleStr.equals("Horizontal")) { - return android.R.attr.progressBarStyleHorizontal; - } else if (styleStr.equals("Small")) { - return android.R.attr.progressBarStyleSmall; - } else if (styleStr.equals("Large")) { - return android.R.attr.progressBarStyleLarge; - } else if (styleStr.equals("Inverse")) { - return android.R.attr.progressBarStyleInverse; - } else if (styleStr.equals("SmallInverse")) { - return android.R.attr.progressBarStyleSmallInverse; - } else if (styleStr.equals("LargeInverse")) { - return android.R.attr.progressBarStyleLargeInverse; - } else if (styleStr.equals("Normal")) { - return android.R.attr.progressBarStyle; - } else { - FLog.w(ReactConstants.TAG, "Unknown ProgressBar style: " + styleStr); - return android.R.attr.progressBarStyle; - } - } - - @Override - public long measure( - Context context, - ReadableMap localData, - ReadableMap props, - ReadableMap state, - float width, - YogaMeasureMode widthMode, - float height, - YogaMeasureMode heightMode, - @Nullable float[] attachmentsPositions) { - - final Integer style = - ReactProgressBarViewManager.getStyleFromString(props.getString(PROP_STYLE)); - Pair value = mMeasuredStyles.get(style); - if (value == null) { - ProgressBar progressBar = ReactProgressBarViewManager.createProgressBar(context, style); - - final int spec = - View.MeasureSpec.makeMeasureSpec( - ViewGroup.LayoutParams.WRAP_CONTENT, View.MeasureSpec.UNSPECIFIED); - progressBar.measure(spec, spec); - value = Pair.create(progressBar.getMeasuredWidth(), progressBar.getMeasuredHeight()); - mMeasuredStyles.put(style, value); - } - - return YogaMeasureOutput.make( - PixelUtil.toDIPFromPixel(value.first), PixelUtil.toDIPFromPixel(value.second)); - } -} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.kt new file mode 100644 index 000000000000..69ad62ac8eb2 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.kt @@ -0,0 +1,165 @@ +/* + * Copyright (c) Meta Platforms, Inc. and 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.progressbar + +import android.content.Context +import android.util.Pair +import android.view.View +import android.widget.ProgressBar +import com.facebook.common.logging.FLog +import com.facebook.react.bridge.ReadableMap +import com.facebook.react.common.ReactConstants +import com.facebook.react.module.annotations.ReactModule +import com.facebook.react.uimanager.BaseViewManager +import com.facebook.react.uimanager.PixelUtil.toDIPFromPixel +import com.facebook.react.uimanager.ThemedReactContext +import com.facebook.react.uimanager.ViewManagerDelegate +import com.facebook.react.uimanager.ViewProps +import com.facebook.react.uimanager.annotations.ReactProp +import com.facebook.react.viewmanagers.AndroidProgressBarManagerDelegate +import com.facebook.react.viewmanagers.AndroidProgressBarManagerInterface +import com.facebook.yoga.YogaMeasureMode +import com.facebook.yoga.YogaMeasureOutput +import java.util.WeakHashMap + +/** + * Manages instances of [ProgressBar]. [ProgressBar] is wrapped in a [ProgressBarContainerView] + * because the style of the [ProgressBar] can only be set in the constructor, whenever the style of + * a [ProgressBar] changes, we have to drop the existing [ProgressBar] (if there is one) and create + * a new one with the style given. + */ +@ReactModule(name = ReactProgressBarViewManager.REACT_CLASS) +public class ReactProgressBarViewManager : + BaseViewManager(), + AndroidProgressBarManagerInterface { + private val measuredStyles = WeakHashMap>() + + private val delegate: ViewManagerDelegate = + AndroidProgressBarManagerDelegate(this) + + public override fun getName(): String = REACT_CLASS + + protected override fun createViewInstance(context: ThemedReactContext): ProgressBarContainerView { + return ProgressBarContainerView(context) + } + + @ReactProp(name = PROP_STYLE) + public override fun setStyleAttr(view: ProgressBarContainerView, styleName: String?) { + view.setStyle(styleName) + } + + @ReactProp(name = ViewProps.COLOR, customType = "Color") + public override fun setColor(view: ProgressBarContainerView, color: Int?) { + view.color = color + } + + @ReactProp(name = PROP_INDETERMINATE) + public override fun setIndeterminate(view: ProgressBarContainerView, indeterminate: Boolean) { + view.indeterminate = indeterminate + } + + @ReactProp(name = PROP_PROGRESS) + public override fun setProgress(view: ProgressBarContainerView, progress: Double) { + view.progress = progress + } + + @ReactProp(name = PROP_ANIMATING) + public override fun setAnimating(view: ProgressBarContainerView, animating: Boolean) { + view.animating = animating + } + + public override fun setTestID(view: ProgressBarContainerView, value: String?) { + super.setTestId(view, value) + } + + @ReactProp(name = PROP_ATTR) + public override fun setTypeAttr(view: ProgressBarContainerView, value: String?): Unit = Unit + + public override fun createShadowNodeInstance(): ProgressBarShadowNode = ProgressBarShadowNode() + + public override fun getShadowNodeClass(): Class = + ProgressBarShadowNode::class.java + + public override fun updateExtraData(root: ProgressBarContainerView, extraData: Any) { + // do nothing + } + + protected override fun onAfterUpdateTransaction(view: ProgressBarContainerView) { + view.apply() + } + + protected override fun getDelegate(): ViewManagerDelegate = delegate + + public override fun measure( + context: Context, + localData: ReadableMap, + props: ReadableMap, + state: ReadableMap, + width: Float, + widthMode: YogaMeasureMode, + height: Float, + heightMode: YogaMeasureMode, + attachmentsPositions: FloatArray? + ): Long { + val style = getStyleFromString(props.getString(PROP_STYLE)) + val value = + measuredStyles.getOrPut(style) { + val progressBar = createProgressBar(context, style) + val spec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED) + progressBar.measure(spec, spec) + Pair.create(progressBar.measuredWidth, progressBar.measuredHeight) + } + + return YogaMeasureOutput.make( + toDIPFromPixel(value.first.toFloat()), toDIPFromPixel(value.second.toFloat())) + } + + public companion object { + public const val REACT_CLASS: String = "AndroidProgressBar" + + internal const val PROP_STYLE: String = "styleAttr" + internal const val PROP_ATTR: String = "typeAttr" + internal const val PROP_INDETERMINATE: String = "indeterminate" + internal const val PROP_PROGRESS: String = "progress" + internal const val PROP_ANIMATING: String = "animating" + internal const val DEFAULT_STYLE: String = "Normal" + + private val progressBarCtorLock = Any() + + /** + * We create ProgressBars on both the UI and shadow threads. There is a race condition in the + * ProgressBar constructor that may cause crashes when two ProgressBars are constructed at the + * same time on two different threads. This static ctor wrapper protects against that. + */ + public fun createProgressBar(context: Context?, style: Int): ProgressBar { + synchronized(progressBarCtorLock) { + return ProgressBar(context, null, style) + } + } + + internal fun getStyleFromString(styleStr: String?): Int { + when (styleStr) { + null -> { + FLog.w(ReactConstants.TAG, "ProgressBar needs to have a style, null received") + return android.R.attr.progressBarStyle + } + "Horizontal" -> return android.R.attr.progressBarStyleHorizontal + "Small" -> return android.R.attr.progressBarStyleSmall + "Large" -> return android.R.attr.progressBarStyleLarge + "Inverse" -> return android.R.attr.progressBarStyleInverse + "SmallInverse" -> return android.R.attr.progressBarStyleSmallInverse + "LargeInverse" -> return android.R.attr.progressBarStyleLargeInverse + "Normal" -> return android.R.attr.progressBarStyle + else -> { + FLog.w(ReactConstants.TAG, "Unknown ProgressBar style: $styleStr") + return android.R.attr.progressBarStyle + } + } + } + } +}