Deprecate MapBuilder and remove Kotlin usages (#45743)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45743

This is a Java-centric class that can be replaced by Kotlin's map extensions.

Changelog:
[Android][Deprecated] Deprecate MapBuilder

Reviewed By: cortinico

Differential Revision: D60309106

fbshipit-source-id: 4a764fa1d59993dc735b2181a2270dc79a0e0396
This commit is contained in:
Thomas Nardone
2024-08-02 13:58:32 -07:00
committed by Facebook GitHub Bot
parent a778979ed6
commit a696d2ed6b
11 changed files with 146 additions and 157 deletions
@@ -10,7 +10,6 @@ package com.facebook.react.osslibraryexample
import android.annotation.SuppressLint
import android.graphics.Color
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.common.MapBuilder
import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.uimanager.SimpleViewManager
import com.facebook.react.uimanager.ThemedReactContext
@@ -52,19 +51,21 @@ internal class SampleNativeComponentViewManager :
override fun getExportedViewConstants(): Map<String, Any> = mapOf("PI" to 3.14)
override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
return MapBuilder.builder<String, Any>()
.put(
"onColorChanged",
MapBuilder.of(
"phasedRegistrationNames",
MapBuilder.of("bubbled", "onColorChanged", "captured", "onColorChangedCapture")))
.put(
"topIntArrayChanged",
MapBuilder.of(
"phasedRegistrationNames",
MapBuilder.of(
"bubbled", "topIntArrayChanged", "captured", "topIntArrayChangedCapture")))
.build()
return mapOf(
"onColorChanged" to
mapOf(
"phasedRegistrationNames" to
mapOf(
"bubbled" to "onColorChanged",
"captured" to "onColorChangedCapture",
)),
"topIntArrayChanged" to
mapOf(
"phasedRegistrationNames" to
mapOf(
"bubbled" to "topIntArrayChanged",
"captured" to "topIntArrayChangedCapture",
)))
}
@SuppressLint("BadMethodUse-android.view.View.setBackgroundColor")