react-native: [Perspective Transform] Animated rotateX + Perspective causes App to crash
Here is a simple repro https://rnplay.org/apps/eiYv8g/
Using PanResponder to drag around and adjust an animated value with an interpolated rotate value will cause the app to eventually crash.
Here is a gif, just quickly dragging it down or up will then cause it to crash.
Stack
2015-09-09 08:47:25.027 animate_slide[46858:2018081] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid number value (infinite) in JSON write'
*** First throw call stack:
(
0 CoreFoundation 0x0000000109d6ec65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001091e2bb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000109d6eb9d +[NSException raise:format:] + 205
3 Foundation 0x0000000108e80c64 _writeJSONNumber + 810
4 Foundation 0x0000000108e7cefc _writeJSONValue + 477
5 Foundation 0x0000000108e8146f ___writeJSONObject_block_invoke + 220
6 CoreFoundation 0x0000000109ce2cd5 __65-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 85
7 CoreFoundation 0x0000000109ce2bec -[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:] + 236
8 Foundation 0x0000000108e81080 _writeJSONObject + 376
9 Foundation 0x0000000108e7cea6 _writeJSONValue + 391
10 Foundation 0x0000000108e8134d ___writeJSONArray_block_invoke + 130
11 CoreFoundation 0x0000000109ca4f22 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 114
12 CoreFoundation 0x0000000109ca467c -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 300
13 Foundation 0x0000000108e81262 _writeJSONArray + 264
14 Foundation 0x0000000108e7cf3c _writeJSONValue + 541
15 Foundation 0x0000000108e8134d ___writeJSONArray_block_invoke + 130
16 CoreFoundation 0x0000000109cb8026 __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 70
17 CoreFoundation 0x0000000109cb7f5c -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 284
18 Foundation 0x0000000108e81262 _writeJSONArray + 264
19 Foundation 0x0000000108e7cf3c _writeJSONValue + 541
20 Foundation 0x0000000108e8134d ___writeJSONArray_block_invoke + 130
21 CoreFoundation 0x0000000109cb8026 __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 70
22 CoreFoundation 0x0000000109cb7f5c -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 284
23 Foundation 0x0000000108e81262 _writeJSONArray + 264
24 Foundation 0x0000000108e7cf3c _writeJSONValue + 541
25 Foundation 0x0000000108e8146f ___writeJSONObject_block_invoke + 220
26 CoreFoundation 0x0000000109ce2cd5 __65-[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 85
27 CoreFoundation 0x0000000109ce2bec -[__NSDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:] + 236
28 Foundation 0x0000000108e81080 _writeJSONObject + 376
29 Foundation 0x0000000108e7cea6 _writeJSONValue + 391
30 Foundation 0x0000000108e8134d ___writeJSONArray_block_invoke + 130
31 CoreFoundation 0x0000000109cb8026 __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 70
32 CoreFoundation 0x0000000109cb7f5c -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 284
33 Foundation 0x0000000108e81262 _writeJSONArray + 264
34 Foundation 0x0000000108e7cf3c _writeJSONValue + 541
35 Foundation 0x0000000108e8134d ___writeJSONArray_block_invoke + 130
36 CoreFoundation 0x0000000109cb8026 __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 70
37 CoreFoundation 0x0000000109cb7f5c -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 284
38 Foundation 0x0000000108e81262 _writeJSONArray + 264
39 Foundation 0x0000000108e7cf3c _writeJSONValue + 541
40 Foundation 0x0000000108e8146f ___writeJSONObject_block_invoke + 220
41 CoreFoundation 0x0000000109cae656 __65-[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]_block_invoke + 102
42 CoreFoundation 0x0000000109cae55c -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 204
43 Foundation 0x0000000108e81080 _writeJSONObject + 376
44 Foundation 0x0000000108e7cea6 _writeJSONValue + 391
45 Foundation 0x0000000108e7ccea -[_NSJSONWriter dataWithRootObject:options:error:] + 137
46 Foundation 0x0000000108e7f76b +[NSJSONSerialization dataWithJSONObject:options:error:] + 345
47 animate_slide 0x0000000108b3b981 RCTJSONStringify + 321
48 animate_slide 0x0000000108ac2aba __49-[RCTWebSocketExecutor sendMessage:waitForReply:]_block_invoke + 570
49 libdispatch.dylib 0x000000010d278186 _dispatch_call_block_and_release + 12
50 libdispatch.dylib 0x000000010d297614 _dispatch_client_callout + 8
51 libdispatch.dylib 0x000000010d27e6a7 _dispatch_queue_drain + 2176
52 libdispatch.dylib 0x000000010d27dcc0 _dispatch_queue_invoke + 235
53 libdispatch.dylib 0x000000010d2813b9 _dispatch_root_queue_drain + 1359
54 libdispatch.dylib 0x000000010d282b17 _dispatch_worker_thread3 + 111
55 libsystem_pthread.dylib 0x000000010d604a9d _pthread_wqthread + 729
56 libsystem_pthread.dylib 0x000000010d6023dd start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 1
- Comments: 30 (26 by maintainers)
Commits related to this issue
- Ensure perspective value is non-zero Summary: Setting `transform: {perspective: 0}` was causing app failure due to `NaN` produced by divide by zero in [MatrixMath.js](https://github.com/facebook/reac... — committed to facebook/react-native by asmockler 8 years ago
- Ensure perspective value is non-zero Summary: Setting `transform: {perspective: 0}` was causing app failure due to `NaN` produced by divide by zero in [MatrixMath.js](https://github.com/facebook/reac... — committed to doostin/react-native by asmockler 8 years ago
I met the same error. It seems that if the element is rotated by 90 deg, the error will happen.