Skip to content

Commit

Permalink
fix(Android): change context while running runOnUiQueueThread on 0.…
Browse files Browse the repository at this point in the history
…73 with Bridgeless (software-mansion#2022)

## Description

I've been discussing this change with @WoLewicki.
The problem here is that you're attempting to call `runOnUiQueueThread`
on the wrong Context.

## Changes

Changes the `Context` where we invoke `.runOnUiQueueThread`

## Test code and steps to reproduce

Tested against this reproducer:
https://github.com/cortinico/reproducer-rnscreens-bridgeless

## Checklist

- [x] Included code example that can be used to test this change
- [x] Ensured that CI passes

Co-authored-by: tboba <[email protected]>
  • Loading branch information
2 people authored and ja1ns committed Oct 9, 2024
1 parent b26631a commit e1cd027
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ open class ScreenContainer(context: Context?) : ViewGroup(context) {
// The exception to this rule is `updateImmediately` which is triggered by actions
// not connected to React view hierarchy changes, but rather internal events
needsUpdate = true
(context as? ReactContext)?.runOnUiQueueThread {
(context.applicationContext as? ReactContext)?.runOnUiQueueThread {
// We schedule the update here because LayoutAnimations of `react-native-reanimated`
// sometimes attach/detach screens after the layout block of `ScreensShadowNode` has
// already run, and we want to update the container then too. In the other cases,
Expand Down

0 comments on commit e1cd027

Please sign in to comment.