Skip to content

Commit b549471

Browse files
adityasharatfacebook-github-bot
authored andcommitted
Fix NPE in ReactProgressBarViewManager.measure() with nullable params
Summary: Match `ViewManager.measure()`'s Java signature (which has always accepted nullable `localData`/`props`/`state`) and the sibling `ReactSwitchManager.kt` pattern. The Kotlin migration in D49551193 (2024-07) wrongly tightened the override on `ReactProgressBarViewManager` to non-null `ReadableMap`, which threw NPE on entry whenever the C++ side passed `nullptr` for `localData` or `state` — which `AndroidProgressBarMeasurementsManager::measure` has always done. The latent bug was masked by Yoga's measure cache plus the now-removed `AndroidProgressBarMeasurementsManager` measurement cache (removed in D60192289, 2025-06). D105720159's CSS Flexbox §4.5 auto-min-size probe reliably bypasses Yoga's cache by calling `node->measure(... AtMost 0 ...)` per flex item, exposing the NPE and crashing Airwave on Android (T273821098, P2359486686). Fix: change `localData`/`props`/`state` to nullable `ReadableMap?` and use safe call on `props?.getString(...)`. This unblocks D105720159 from being re-landed. Differential Revision: D107178838
1 parent d659203 commit b549471

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,16 @@ internal class ReactProgressBarViewManager :
100100

101101
override fun measure(
102102
context: Context,
103-
localData: ReadableMap,
104-
props: ReadableMap,
105-
state: ReadableMap,
103+
localData: ReadableMap?,
104+
props: ReadableMap?,
105+
state: ReadableMap?,
106106
width: Float,
107107
widthMode: YogaMeasureMode,
108108
height: Float,
109109
heightMode: YogaMeasureMode,
110110
attachmentsPositions: FloatArray?,
111111
): Long {
112-
val style = getStyleFromString(props.getString(PROP_STYLE))
112+
val style = getStyleFromString(props?.getString(PROP_STYLE))
113113
val value =
114114
measuredStyles.getOrPut(style) {
115115
val progressBar = createProgressBar(context, style)

0 commit comments

Comments
 (0)