jpudysz / react-native-unistyles

Level up your React Native StyleSheet
https://unistyl.es
MIT License
1.54k stars 42 forks source link

App Crashes on iPad Air (5th Gen) - emitDeviceEvent in UnistylesModel Causes Crash #335

Open salahamassi opened 1 week ago

salahamassi commented 1 week ago

Description

We are experiencing a crash in our React Native app using react-native-unistyles. This crash occurs on an iPad Air (5th generation) running iPadOS 18.1. Below is the relevant stack trace from Firebase:

Stack Trace:

Crashed: com.apple.main-thread
0  GoSteer                        0x11537f4 UnistylesModel::emitDeviceEvent(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::variant<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, int, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::variant<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, int>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::variant<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, int>>>>>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::variant<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, int, std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::variant<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, int>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, std::__1::variant<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, int>>>>>>>>) + 113 (UnistylesModel.cpp:113)

```1  GoSteer                        0x1152d20 UnistylesModel::onLayoutChange() + 1102 (__tree:1102)
2  GoSteer                        0x1152688 UnistylesModel::handleScreenSizeChange(Screen&, std::__1::optional<Insets>, std::__1::optional<Dimensions>, std::__1::optional<Dimensions>) + 1734 (string:1734)
3  GoSteer                        0x114b3e4 __27-[Platform onWindowChange:]_block_invoke + 130 (Platform_iOS.mm:130)
4  libdispatch.dylib              0x40d0 _dispatch_client_callout + 20
5  libdispatch.dylib              0x7580 _dispatch_continuation_pop + 596
6  libdispatch.dylib              0x1b53c _dispatch_source_latch_and_call + 420
7  libdispatch.dylib              0x1a104 _dispatch_source_invoke + 836
8  libdispatch.dylib              0x128f4 _dispatch_main_queue_drain + 744
9  libdispatch.dylib              0x125fc _dispatch_main_queue_callback_4CF + 44
10 CoreFoundation                 0x56204 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
11 CoreFoundation                 0x53440 __CFRunLoopRun + 1996
12 CoreFoundation                 0x52830 CFRunLoopRunSpecific + 588
13 GraphicsServices               0x11c4 GSEventRunModal + 164
14 UIKitCore                      0x3d2eb0 -[UIApplication _run] + 816
15 UIKitCore                      0x4815b4 UIApplicationMain + 340
16 GoSteer                        0x47c0 main + 7 (main.m:7)
17 ???                            0x1b6aeaec8 (Missing)

Device Details:

Steps to reproduce

  1. Open the app on an iPad Air (5th gen) running iPadOS 18.1.
  2. Interact with the app to trigger layout changes or screen rotations.
  3. Observe the app crashing with the above stack trace.

Snack or a link to a repository (optional)

No response

Unistyles version

2.9.2

React Native version

0.74.5

Platforms

iOS

Engine

Hermes

Architecture

Fabric (new)

jpudysz commented 6 days ago

I've tried to repro with example app, but with no luck. It crashed while calling React Native callinvoker:

this->callInvoker->invokeAsync(...)

Without the repro I won't be able to help 😥

jpudysz commented 3 days ago

Does it happen often? Any more details?