Skip to content

Commit 4d45e59

Browse files
vzaidmanfacebook-github-bot
authored andcommitted
Align Android with iOS in displaying HMR "refreshing" in color (#53846)
Summary: Pull Request resolved: #53846 Changelog: [Android][Added] - hot reload banner is now displayed in blue background like on iOS iOS has a colorful "Refreshing..." banner: {F1982086204} While android doesn't respect the color HMR asks it to set up for the banner: {F1982086218} Reviewed By: cortinico Differential Revision: D82726743 fbshipit-source-id: 4042851f5a8fd7d4f238f25e2d83f77144742de9
1 parent 2e4da10 commit 4d45e59

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevLoadingViewImplementation.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ public class DefaultDevLoadingViewImplementation(
3333
private var devLoadingPopup: PopupWindow? = null
3434

3535
override fun showMessage(message: String) {
36+
showMessage(message, color = null, backgroundColor = null)
37+
}
38+
39+
override fun showMessage(message: String, color: Double?, backgroundColor: Double?) {
3640
if (!isEnabled) {
3741
return
3842
}
39-
UiThreadUtil.runOnUiThread { showInternal(message) }
43+
UiThreadUtil.runOnUiThread { showInternal(message, color, backgroundColor) }
4044
}
4145

4246
override fun updateProgress(status: String?, done: Int?, total: Int?) {
@@ -59,7 +63,7 @@ public class DefaultDevLoadingViewImplementation(
5963
}
6064
}
6165

62-
private fun showInternal(message: String) {
66+
private fun showInternal(message: String, color: Double?, backgroundColor: Double?) {
6367
if (devLoadingPopup?.isShowing == true) {
6468
// already showing
6569
return
@@ -84,6 +88,12 @@ public class DefaultDevLoadingViewImplementation(
8488
currentActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
8589
val view = inflater.inflate(R.layout.dev_loading_view, null) as TextView
8690
view.text = message
91+
if (color != null) {
92+
view.setTextColor(color.toInt())
93+
}
94+
if (backgroundColor != null) {
95+
view.setBackgroundColor(backgroundColor.toInt())
96+
}
8797
val popup =
8898
PopupWindow(
8999
view,

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevLoadingViewManager.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ package com.facebook.react.devsupport.interfaces
1111
public interface DevLoadingViewManager {
1212
public fun showMessage(message: String)
1313

14+
public fun showMessage(message: String, color: Double?, backgroundColor: Double?)
15+
1416
public fun updateProgress(status: String?, done: Int?, total: Int?)
1517

1618
public fun hide()

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/devloading/DevLoadingModule.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ internal class DevLoadingModule(reactContext: ReactApplicationContext) :
3131
}
3232

3333
override fun showMessage(message: String, color: Double?, backgroundColor: Double?) {
34-
UiThreadUtil.runOnUiThread { devLoadingViewManager?.showMessage(message) }
34+
UiThreadUtil.runOnUiThread {
35+
devLoadingViewManager?.showMessage(message, color, backgroundColor)
36+
}
3537
}
3638

3739
override fun hide() {

0 commit comments

Comments
 (0)