Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when editing with Cells as children #52

Closed
chetstone opened this issue Nov 15, 2015 · 4 comments
Closed

Crash when editing with Cells as children #52

chetstone opened this issue Nov 15, 2015 · 4 comments

Comments

@chetstone
Copy link
Contributor

In the TableViewDemo example, if I change the children of the Edit example from <Item> to <Cell> (like I have done here), I get a crash when I try to delete one of the items. Sometimes the first item can be deleted without a crash but the second deletion will cause the crash.
I believe this is probably related to Issues #19 and #29.

2015-11-15 14:00:02.139 [info][tid:com.facebook.React.JavaScript] 'Running application "TableViewExample" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF'
2015-11-15 14:00:10.139 TableViewDemo[72656:3397680] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 7 beyond bounds [0 .. 6]'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000107a21f45 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000106bfadeb objc_exception_throw + 48
    2   CoreFoundation                      0x00000001079059e4 -[__NSArrayM objectAtIndex:] + 212
    3   TableViewDemo                       0x00000001065d2465 -[RNTableView dataForRow:section:] + 133
    4   TableViewDemo                       0x00000001065d1e0e -[RNTableView tableView:cellForRowAtIndexPath:] + 190
    5   UIKit                               0x00000001095d0e2a -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 782
    6   UIKit                               0x00000001095d0f3f -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 74
    7   UIKit                               0x00000001095a6307 -[UITableView _updateVisibleCellsNow:isRecursive:] + 3187
    8   UIKit                               0x00000001095d9d1c -[UITableView _performWithCachedTraitCollection:] + 92
    9   UIKit                               0x00000001095c1884 -[UITableView layoutSubviews] + 223
    10  UIKit                               0x000000010952fe40 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 710
    11  QuartzCore                          0x00000001091fb59a -[CALayer layoutSublayers] + 146
    12  QuartzCore                          0x00000001091efe70 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
    13  QuartzCore                          0x00000001091efcee _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    14  QuartzCore                          0x00000001091e4475 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
    15  QuartzCore                          0x0000000109211c0a _ZN2CA11Transaction6commitEv + 486
    16  QuartzCore                          0x000000010921237c _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
    17  CoreFoundation                      0x000000010794d947 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    18  CoreFoundation                      0x000000010794d8b7 __CFRunLoopDoObservers + 391
    19  CoreFoundation                      0x000000010794350b __CFRunLoopRun + 1147
    20  CoreFoundation                      0x0000000107942e08 CFRunLoopRunSpecific + 488
    21  GraphicsServices                    0x000000010cbfdad2 GSEventRunModal + 161
    22  UIKit                               0x000000010947b30d UIApplicationMain + 171
    23  TableViewDemo                       0x00000001064e6e7f main + 111
    24  libdyld.dylib                       0x000000010b11892d start + 1
    25  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
@aksonov
Copy link
Owner

aksonov commented Nov 17, 2015

Cell usage is quite experimental right now, maybe i have to add it to README. This component is more intended for standard cell tableview usage. For custom cells, probably built-in ListView will be better.

@zorantodorovic
Copy link

@chetstone: If you want to "hack" it, you can add one Item for every Cell that you have. It will work beacuse Item will put index for Cell. So you need to have equal number of Items and Cells. Of course Items would be invisible if you have just empty Item tags ()

@chetstone
Copy link
Contributor Author

@maranbomater Thanks, that helps a little bit, the cells now render without crashing but when I try to delete one I run into issue #19 ;-(

@chetstone
Copy link
Contributor Author

The workaround for this is to use reactModuleForCell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants