Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ The library reports geometry and does not reposition content. Normal safe area i

## Measurement timing

The first measurement requests synchronous delivery; later changes are regular
On Android, the first measurement requests synchronous delivery; later changes are regular
events. Android measures after Fabric mounting
and again on its own relayout, fold changes and window inset changes; scrolling
or moving an ancestor does not trigger a measurement. On iOS, same-frame delivery requires React Native
[#58530](https://github.com/react/react-native/pull/58530); see
or moving an ancestor does not trigger a measurement. On iOS, every measurement is a regular
event; see
[measurement timing](https://rnrr.appandflow.com/docs/platforms#measurement-timing).
Readiness indicates a completed measurement, not a
universal first-frame guarantee.
Expand Down
12 changes: 6 additions & 6 deletions ios/ReservedRegionsView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ - (void)updateRegions
return;
}
_hasDispatchedRegions = YES;
eventEmitter->experimental_flushSync([eventEmitter, regions = std::move(regionPayloads)]() mutable {
eventEmitter->dispatchEvent(
"regionsChange",
folly::dynamic::object("regions", std::move(regions)),
RawEvent::Category::Discrete);
});
// Not experimental_flushSync: it makes the main thread wait for JS, so a JS call that uses
// dispatch_sync to the main queue at that moment deadlocks the app (#45).
eventEmitter->dispatchEvent(
"regionsChange",
folly::dynamic::object("regions", std::move(regionPayloads)),
RawEvent::Category::Discrete);
}

- (void)prepareForRecycle
Expand Down
4 changes: 2 additions & 2 deletions website/docs/platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ On Android:
- A parent view that consumes window insets can prevent cutout updates from reaching the provider.
- After a provider is detached and reattached, it only measures again if its position or size within its parent, folding features, or cutout changed while detached.

The first measurement requests synchronous delivery to React. Later measurements use regular events. React Native limits synchronous delivery to one event per view and event name per frame, so regular events allow later changes in the same frame to be delivered. Intermediate updates may be combined before JavaScript processes them.
On Android, the first measurement requests synchronous delivery to React. Later measurements use regular events. React Native limits synchronous delivery to one event per view and event name per frame, so regular events allow later changes in the same frame to be delivered. Intermediate updates may be combined before JavaScript processes them.

On iOS, processing the first measurement in the same frame requires [React Native #58530](https://github.com/react/react-native/pull/58530). The example’s React Native `0.88.0-rc.1` does not include it.
On iOS, every measurement uses a regular event. A synchronous flush makes the main thread wait for JavaScript, and a JavaScript call that waits for the main thread at the same moment would deadlock the app.

Readiness confirms that a measurement has completed. It does not guarantee that the resulting layout appears in the first visible frame.