Skip to content

Commit d2b876f

Browse files
committed
Add a warning about transitionEnd for listeners
1 parent 11f081d commit d2b876f

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

versioned_docs/version-7.x/navigation-events.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,17 @@ const Tab = createBottomTabNavigatior({
378378
</TabItem>
379379
</Tabs>
380380

381+
:::warning
382+
383+
The listeners added with the `listeners` prop are only active as long as the screen is in navigation state. So some events such as `transitionEnd` in stack may not fire when going back as screen is removed from the state before the transition ends.
384+
385+
:::
386+
381387
### `screenListeners` prop on the navigator
382388

383-
You can pass a prop named `screenListeners` to the navigator component, where you can specify listeners for events from all screens for this navigator. This can be useful if you want to listen to specific events regardless of the screen, or want to listen to common events such as `state` which is emitted to all screens.
389+
You can pass a prop named `screenListeners` to the navigator component, where you can specify listeners for events from all screens for this navigator. It behaves identically to the `listeners` prop on `Screen`.
390+
391+
This can be useful if you want to listen to specific events regardless of the screen, or want to listen to common events such as `state` which is emitted to all screens.
384392

385393
Example:
386394

versioned_docs/version-8.x/navigation-events.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,17 @@ const Tab = createBottomTabNavigatior({
378378
</TabItem>
379379
</Tabs>
380380

381+
:::warning
382+
383+
The listeners added with the `listeners` prop are only active as long as the screen is in navigation state. So some events such as `transitionEnd` in stack may not fire when going back as screen is removed from the state before the transition ends.
384+
385+
:::
386+
381387
### `screenListeners` prop on the navigator
382388

383-
You can pass a prop named `screenListeners` to the navigator component, where you can specify listeners for events from all screens for this navigator. This can be useful if you want to listen to specific events regardless of the screen, or want to listen to common events such as `state` which is emitted to all screens.
389+
You can pass a prop named `screenListeners` to the navigator component, where you can specify listeners for events from all screens for this navigator. It behaves identically to the `listeners` prop on `Screen`.
390+
391+
This can be useful if you want to listen to specific events regardless of the screen, or want to listen to common events such as `state` which is emitted to all screens.
384392

385393
Example:
386394

0 commit comments

Comments
 (0)