Expensify / react-native-live-markdown

Drop-in replacement for React Native's TextInput component with Markdown formatting.
https://www.npmjs.com/package/@expensify/react-native-live-markdown
MIT License
857 stars 62 forks source link

Mutiline prop causes crash on Mac Catalyst built for iOS new Arch #334

Open psquizzle opened 7 months ago

psquizzle commented 7 months ago

When running an iOS build using Mac Catalyst on a M1 Mac and setting multiline={true} while editing the component on a screen with hot reload It crashes when I navigate away from the screen containing <MarkdownTextInput/>. If multiline is already set to true it crashes on navigating to the screen with the below error report. Seems to work fine on an iOS device.

 const [text, setText] = React.useState('Hello, *world*!');
   <MarkdownTextInput
      value={text}
      multiline={true}
      onChangeText={setText}
    />
Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000001df5da8
Exception Codes: 0x0000000000000001, 0x0000000001df5da8
VM Region Info: 0x1df5da8 is not in any region.  Bytes before following region: 4275511896
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      100b68000-101bc0000    [ 16.3M] r-x/r-x SM=COW  ...p.app/snipmap
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [66688]

Triggered by Thread:  0

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                        0x1888dbff0 objc_release + 16
1   snipmap                                0x100ebcc98 -[MarkdownLayoutManager setMarkdownUtils:] + 48
2   Foundation                             0x189e65d7c -[NSObject(NSKeyValueCoding) setValue:forKey:] + 324
3   snipmap                                0x100ecd540 -[MarkdownTextInputDecoratorView didMoveToWindow] + 2320 (MarkdownTextInputDecoratorView.mm:76)
4   UIKitCore                              0x1b771806c -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1632
5   UIKitCore                              0x1b7717cac -[UIView(Internal) _didMoveFromWindow:toWindow:] + 672
6   UIKitCore                              0x1b7717cac -[UIView(Internal) _didMoveFromWindow:toWindow:] + 672
7   UIKitCore                              0x1b7717cac -[UIView(Internal) _didMoveFromWindow:toWindow:] + 672
8   UIKitCore                              0x1b76dfc2c __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 124
9   UIKitCore                              0x1b76dfac4 -[UIView(Hierarchy) _postMovedFromSuperview:] + 484
10  UIKitCore                              0x1b76dee00 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1908
11  UIKitCore                              0x1b7d35f60 -[_UIParallaxDimmingView didMoveToWindow] + 132
12  UIKitCore                              0x1b771806c -[UIView(Internal) _didMoveFromWindow:toWindow:] + 1632
13  UIKitCore                              0x1b7717cac -[UIView(Internal) _didMoveFromWindow:toWindow:] + 672
14  UIKitCore                              0x1b76dfc2c __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 124
15  UIKitCore                              0x1b76dfac4 -[UIView(Hierarchy) _postMovedFromSuperview:] + 484
16  UIKitCore                              0x1b76dee00 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1908
17  UIKitCore                              0x1b7d32fa4 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke_2 + 1296
18  UIKitCore                              0x1b76efb70 +[UIView(Animation) performWithoutAnimation:] + 76
19  UIKitCore                              0x1b7d32a44 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 240
20  UIKitCore                              0x1b77a77dc +[UIView(Internal) _performBlockDelayingTriggeringResponderEvents:forScene:] + 136
21  UIKitCore                              0x1b7d32540 -[_UINavigationParallaxTransition animateTransition:] + 952
22  UIKitCore                              0x1b7d24184 ___UIViewControllerTransitioningRunCustomTransition_block_invoke_3 + 52
23  UIKitCore                              0x1b7e5693c +[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:] + 96
24  UIKitCore                              0x1b7725b10 ___UIViewControllerTransitioningRunCustomTransition_block_invoke_2 + 196
25  UIKitCore                              0x1b7725958 +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] + 180
26  UIKitCore                              0x1b772580c _UIViewControllerTransitioningRunCustomTransition + 484
27  UIKitCore                              0x1b7c6fc7c -[UINavigationController _startCustomTransition:] + 3292
28  UIKitCore                              0x1b7755568 -[UINavigationController _startDeferredTransitionIfNeeded:] + 496
29  UIKitCore                              0x1b7774214 -[UINavigationController __viewWillLayoutSubviews] + 96
30  UIKitCore                              0x1b775f300 -[UILayoutContainerView layoutSubviews] + 172
31  UIKit                                  0x22bcd0224 -[UILayoutContainerViewAccessibility layoutSubviews] + 60
32  UIKitCore                              0x1b771b8a0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1452
33  QuartzCore                             0x190e7b274 CA::Layer::layout_if_needed(CA::Transaction*) + 520
34  QuartzCore                             0x191000d98 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 500
35  QuartzCore                             0x190e5e8f0 CA::Transaction::commit() + 648
36  QuartzCore                             0x191033ab8 CA::Transaction::flush_as_runloop_observer(bool) + 136
37  CoreFoundation                         0x188d86d80 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
38  CoreFoundation                         0x188d86c6c __CFRunLoopDoObservers + 532
39  CoreFoundation                         0x188d85988 CFRunLoopRunSpecific + 684
40  HIToolbox                              0x19334e448 RunCurrentEventLoopInMode + 292
41  HIToolbox                              0x19334e284 ReceiveNextEventCommon + 648
42  HIToolbox                              0x19334dfdc _BlockUntilNextEventMatchingListInModeWithFilter + 76
43  AppKit                                 0x18c564ed0 _DPSNextEvent + 660
44  AppKit                                 0x18cd4feec -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
45  AppKit                                 0x18c55837c -[NSApplication run] + 476
46  AppKit                                 0x18c52f640 NSApplicationMain + 880
47  AppKit                                 0x18c7818fc _NSApplicationMainWithInfoDictionary + 24
48  UIKitMacHelper                         0x1a1a2d6b8 UINSApplicationMain + 972
49  UIKitCore                              0x1b76900f8 UIApplicationMain + 148
50  snipmap                                0x100b707c0 main + 96 (main.m:7)
51  dyld                                   0x1889290e0 start + 2360
tomekzaw commented 7 months ago

@psquizzle Thanks for submitting this issue. It looks similar to https://github.com/Expensify/react-native-live-markdown/issues/257.