Fix several build warnings on RN Tester Android (#41660)

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

While working on other things, I noticed those warnings firing on console which I'm fixing here.

Changelog:
[Internal] [Changed] - Fix several build warnings on RN Tester Android

Reviewed By: cipolleschi

Differential Revision: D51589072

fbshipit-source-id: 1ddb29afd0d150f1ccbc7a8def9f27ecedb69724
This commit is contained in:
Nicola Corti
2023-11-28 07:08:54 -08:00
committed by Facebook GitHub Bot
parent 4f3094aba4
commit 25196ba24f
3 changed files with 7 additions and 9 deletions
@@ -20,12 +20,11 @@ class RNTesterActivity : ReactActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
// Get remote param before calling super which uses it
val bundle = activity.getIntent()?.getExtras()
val bundle = activity.intent?.extras
if (bundle != null && bundle.containsKey(PARAM_ROUTE)) {
val routeUri = "rntester://example/${bundle.getString(PARAM_ROUTE)}Example"
initialProps = Bundle()
initialProps?.putString("exampleFromAppetizeParams", routeUri)
initialProps = Bundle().apply { putString("exampleFromAppetizeParams", routeUri) }
}
super.onCreate(savedInstanceState)
@@ -35,15 +35,13 @@ internal class MyLegacyViewManager(reactContext: ReactApplicationContext) :
}
@ReactProp(name = ViewProps.COLOR)
fun setColor(view: MyNativeView, color: String) {
view.setBackgroundColor(Color.parseColor(color))
fun setColor(view: MyNativeView, color: String?) {
color?.let { view.setBackgroundColor(Color.parseColor(it)) }
}
@ReactProp(name = "cornerRadius")
fun setCornerRadius(view: MyNativeView, cornerRadius: Float) {
if (cornerRadius !== null) {
view.setCornerRadius(cornerRadius)
}
fun setCornerRadius(view: MyNativeView, cornerRadius: Float?) {
cornerRadius?.let { view.setCornerRadius(it) }
}
override fun getExportedViewConstants(): Map<String, Any> = mapOf("PI" to 3.14)
@@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
@file:Suppress("DEPRECATION") // As we want to test RCTEventEmitter here
package com.facebook.react.uiapp.component
import android.graphics.Color