Summary
When EnrichedMarkdownText is used inside any container that measures content height via onLayout, long markdown content gets clipped on iOS. The last paragraph is cut off or only appears when the user scrolls. The issue does not reproduce on Android.
Confirmed with @gorhom/bottom-sheet (v5), but affects any component that sizes itself based on onLayout measurements — bottom sheets, modal sheets, collapsible panels, auto-sizing wrappers, etc.
The problem
Containers that measure content height via onLayout get an incomplete measurement because the native markdown view has not finished rendering when the first onLayout fires.
With the native rendering pipeline, applyRenderedText() is posted to the main thread after parsing completes on a background thread. This means:
- The container's
onLayout fires when the wrapping view first reports its height
- At that point, the native markdown view hasn't finished rendering all paragraphs yet
- The container snaps/sizes to this incomplete height
- Trailing content is cut off — only visible if the user scrolls
Workaround
Remounting the container (via a React key change) forces a fresh measure cycle after the markdown has fully rendered. This works but is wasteful and causes a visible flash/flicker.
Expected behavior
The native view should trigger a layout invalidation after applyRenderedText() completes, so parent containers can re-measure with the final content height without requiring a full remount.
Environment
- Library version: 1.0.2
- React Native: 0.83.6 (Fabric / New Architecture)
- Confirmed with:
@gorhom/bottom-sheet ^5.2.8 (but not specific to it)
- Platform: iOS only (not reproducible on Android)
Summary
When
EnrichedMarkdownTextis used inside any container that measures content height viaonLayout, long markdown content gets clipped on iOS. The last paragraph is cut off or only appears when the user scrolls. The issue does not reproduce on Android.Confirmed with
@gorhom/bottom-sheet(v5), but affects any component that sizes itself based ononLayoutmeasurements — bottom sheets, modal sheets, collapsible panels, auto-sizing wrappers, etc.The problem
Containers that measure content height via
onLayoutget an incomplete measurement because the native markdown view has not finished rendering when the firstonLayoutfires.With the native rendering pipeline,
applyRenderedText()is posted to the main thread after parsing completes on a background thread. This means:onLayoutfires when the wrapping view first reports its heightWorkaround
Remounting the container (via a React
keychange) forces a fresh measure cycle after the markdown has fully rendered. This works but is wasteful and causes a visible flash/flicker.Expected behavior
The native view should trigger a layout invalidation after
applyRenderedText()completes, so parent containers can re-measure with the final content height without requiring a full remount.Environment
@gorhom/bottom-sheet^5.2.8 (but not specific to it)