react-native-macos icon indicating copy to clipboard operation
react-native-macos copied to clipboard

TextInput multiline - CALayer position contains NaN: [nan nan]

Open krablak opened this issue 8 years ago • 2 comments

Hi, at first, thanks for the great project. Unfortunately I met issue when application got stuck with CALayer position contains NaN: [nan nan] error after switch from TextInput with enabled multiline into another TextInput.

Details:

  • Issue happens only on macos and same view on ios is working correctly.
  • Cause of the issue is in RCTUITextView.updateContentSize where is defined CGSize as {_scrollView.frame.size.width, INFINITY} which is set to text view frame field and during resizing computation fails (see full log bellow for details).
    • As workaround works setting height to any number instead of INFINITY but definitely it's not correct solution
  • Versions:
    • OSX : System Version: OS X 10.11.6 (15G1004)
    • Xcode : Version 8.0 (8A218a)
    • react-native-macos-cli: 0.2.1
    • react-native-macos-cli:: 0.11.0-rc1
  • Project with mini app where is possible to reproduce this issue is in multilinebug.zip

View looks like this:

	<View style={{ flex: 1, flexDirection: 'column', justifyContent: 'space-between', alignItems: 'stretch' }}>
            <View style={{ flex: 1, backgroundColor: 'skyblue', justifyContent: 'center' }}>
            </View>
            <View style={{ flex: 1, backgroundColor: 'steelblue', justifyContent: 'center' }}>                    
                <TextInput placeholder="Step one: Click here... to make field active." multiline={true} style={{flex: 1, backgroundColor: 'white'}}/>
            </View>
            <View style={{ flex: 1, backgroundColor: 'skyblue', justifyContent: 'center' }}>
            </View>
            <View style={{ flex: 1, backgroundColor: 'skyblue', justifyContent: 'center' }}>
                <TextInput value="Step two: Click here... and app is stucked :("  style={{flex: 1}}/>
            </View>                
        </View>
        

And error in output is:

2016-11-15 20:20:40.391 multilinebug[23511:1049921] CALayer position contains NaN: [nan nan]
2016-11-15 20:20:40.395 multilinebug[23511:1049921] (
	0   CoreFoundation                      0x00007fff901054f2 __exceptionPreprocess + 178
	1   libobjc.A.dylib                     0x00007fff94a0f73c objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff9016c4bd +[NSException raise:format:] + 205
	3   QuartzCore                          0x00007fff97d079b6 _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 152
	4   QuartzCore                          0x00007fff97d07916 -[CALayer setPosition:] + 44
	5   AppKit                              0x00007fff8dad0759 -[NSView(NSInternal) _updateLayerGeometryFromView] + 2970
	6   AppKit                              0x00007fff8daeb319 -[NSView setFrameSize:] + 1245
	7   AppKit                              0x00007fff8db8d1b4 -[NSTextView(NSPrivate) _setFrameSize:forceScroll:] + 724
	8   AppKit                              0x00007fff8db8ce8c -[NSTextView setFrameSize:] + 104
	9   AppKit                              0x00007fff8db0390d -[NSView setFrame:] + 476
	10  multilinebug                        0x00000001000fd3ba -[RCTTextView updateContentSize] + 410
	11  multilinebug                        0x00000001000ffaea -[RCTTextView textDidEndEditing:] + 58
	12  CoreFoundation                      0x00007fff90090bbc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
	13  CoreFoundation                      0x00007fff90090b4f ___CFXRegistrationPost_block_invoke + 63
	14  CoreFoundation                      0x00007fff90090ac7 _CFXRegistrationPost + 407
	15  CoreFoundation                      0x00007fff90090832 ___CFXNotificationPost_block_invoke + 50
	16  CoreFoundation                      0x00007fff9004d5e2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1922
	17  CoreFoundation                      0x00007fff9004c835 _CFXNotificationPost + 693
	18  Foundation                          0x00007fff8af5917a -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
	19  AppKit                              0x00007fff8dc90481 -[NSTextView(NSSharing) resignFirstResponder] + 942
	20  AppKit                              0x00007fff8db8532f -[NSWindow _realMakeFirstResponder:] + 228
	21  AppKit                              0x00007fff8db851f7 -[NSWindow makeFirstResponder:] + 123
	22  AppKit                              0x00007fff8e2910a5 -[NSWindow _handleMouseDownEvent:isDelayedEvent:] + 5518
	23  AppKit                              0x00007fff8e2923ad -[NSWindow _reallySendEvent:isDelayedEvent:] + 212
	24  AppKit                              0x00007fff8dcd1539 -[NSWindow sendEvent:] + 517
	25  AppKit                              0x00007fff8dc51a38 -[NSApplication sendEvent:] + 2540
	26  AppKit                              0x00007fff8dab8df2 -[NSApplication run] + 796
	27  multilinebug                        0x0000000100001eda main + 234
	28  libdyld.dylib                       0x00007fff9cbbd5ad start + 1
)
2016-11-15 20:20:40.396 multilinebug[23511:1049921] CALayer position contains NaN: [nan nan]
2016-11-15 20:20:40.400 multilinebug[23511:1049921] (
	0   CoreFoundation                      0x00007fff901054f2 __exceptionPreprocess + 178
	1   libobjc.A.dylib                     0x00007fff94a0f73c objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff9016c4bd +[NSException raise:format:] + 205
	3   QuartzCore                          0x00007fff97d079b6 _ZN2CA5Layer12set_positionERKNS_4Vec2IdEEb + 152
	4   QuartzCore                          0x00007fff97d07916 -[CALayer setPosition:] + 44
	5   AppKit                              0x00007fff8dad0759 -[NSView(NSInternal) _updateLayerGeometryFromView] + 2970
	6   AppKit                              0x00007fff8daf0747 -[NSView setFrameOrigin:] + 865
	7   AppKit                              0x00007fff8db038ea -[NSView setFrame:] + 441
	8   multilinebug                        0x00000001000fd13c -[RCTTextView updateFrames] + 268
	9   multilinebug                        0x00000001001000b8 -[RCTTextView layout] + 88
	10  AppKit                              0x00007fff8db793e7 -[NSView _doLayout] + 53
	11  AppKit                              0x00007fff8dc2801f -[NSView(NSLayerKitGlue) _layoutSublayersOfLayer:] + 458
	12  QuartzCore                          0x00007fff97d19f4b -[CALayer layoutSublayers] + 224
	13  AppKit                              0x00007fff8dc27e48 _NSBackingLayerLayoutSublayers + 158
	14  QuartzCore                          0x00007fff97d0f144 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
	15  QuartzCore                          0x00007fff97d0efc2 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
	16  QuartzCore                          0x00007fff97d0e4a1 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
	17  QuartzCore                          0x00007fff97d0e0ec _ZN2CA11Transaction6commitEv + 508
	18  QuartzCore                          0x00007fff97d19977 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 71
	19  CoreFoundation                      0x00007fff9009a067 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
	20  CoreFoundation                      0x00007fff90099fd7 __CFRunLoopDoObservers + 391
	21  CoreFoundation                      0x00007fff90078ef8 CFRunLoopRunSpecific + 328
	22  HIToolbox                           0x00007fff9a3ad935 RunCurrentEventLoopInMode + 235
	23  HIToolbox                           0x00007fff9a3ad677 ReceiveNextEventCommon + 184
	24  HIToolbox                           0x00007fff9a3ad5af _BlockUntilNextEventMatchingListInModeWithFilter + 71
	25  AppKit                              0x00007fff8dac4df6 _DPSNextEvent + 1067
	26  AppKit                              0x00007fff8dac4226 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
	27  AppKit                              0x00007fff8dab8d80 -[NSApplication run] + 682
	28  multilinebug                        0x0000000100001eda main + 234
	29  libdyld.dylib                       0x00007fff9cbbd5ad start + 1

krablak avatar Nov 15 '16 20:11 krablak

Still an issue -- can repro w/

  • a normal text input & a multiline text input on the same page, first focus the multiline one, then focus the normal one, and the multiline one disappears, w/ that error showing up in the logs

jaredly avatar Apr 19 '17 23:04 jaredly

Thanks for a feedback. TextInput is a bit mess, will try to fix this one, after merging with latest React native.

ptmt avatar Apr 20 '17 06:04 ptmt