Skip to content

Commit 70de91f

Browse files
authored
Merge branch 'main' into @ksienkiewicz/fix-web-set-link-serialization-consistency
2 parents 7ae9261 + 55002b1 commit 70de91f

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputViewLayoutManager.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ class EnrichedTextInputViewLayoutManager(
88
private var forceHeightRecalculationCounter: Int = 0
99

1010
fun invalidateLayout() {
11+
val stateWrapper = view.stateWrapper ?: return
12+
1113
val text = view.text
1214
val paint = view.paint
1315

1416
val needUpdate = MeasurementStore.store(view.id, text, paint)
1517
if (!needUpdate) return
1618

17-
val counter = forceHeightRecalculationCounter
1819
forceHeightRecalculationCounter++
1920
val state = Arguments.createMap()
20-
state.putInt("forceHeightRecalculationCounter", counter)
21-
view.stateWrapper?.updateState(state)
21+
state.putInt("forceHeightRecalculationCounter", forceHeightRecalculationCounter)
22+
stateWrapper.updateState(state)
2223
}
2324

2425
fun releaseMeasurementStore() {

android/src/main/java/com/swmansion/enriched/textinput/MeasurementStore.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ object MeasurementStore {
130130
props: ReadableMap?,
131131
): Float {
132132
val propsFontSize = props?.getDouble("fontSize")?.toFloat()
133-
if (propsFontSize == null) return defaultView.textSize
133+
if (propsFontSize == null || propsFontSize <= 0) return defaultView.textSize
134134

135135
return ceil(pixelFromSpOrDp(propsFontSize, allowFontScalingFromProps(props)))
136136
}

android/src/main/new_arch/react/renderer/components/ReactNativeEnrichedSpec/EnrichedTextInputShadowNode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class EnrichedTextInputShadowNode final
4747
const LayoutConstraints &layoutConstraints) const override;
4848

4949
private:
50-
int forceHeightRecalculationCounter_;
50+
int forceHeightRecalculationCounter_{0};
5151
std::shared_ptr<EnrichedTextInputMeasurementManager> measurementsManager_;
5252
};
5353
} // namespace facebook::react

0 commit comments

Comments
 (0)