Please sign in to comment.
Fixed crash caused by NaN values in RCTTouchEvent
Summary: React Native uses JSON to marshal the data across the bridge. And because of this we have to avoid using NaN and INF values in events and other pieces of data that suppose to be transfered to/from JS side. (We also don't want to introduce additional wrapping/escaping semantics for perfomance reasons.) So, we have to gate all particular cases where there is a possibility of NaN or INF values, and replace these value with something meaningful for each particular case. We are using `0` as NaN substitution here because: * NaN in touch event is super rare case; * Conversion to `0` is fast; * `0` is okay value for product code in most cases; * In all cases `0` is decent analog to "undefined position on screen" for touch event; * Nobody will explicitly handle NaN case in product code, just because it is super rare case and actually indicates that something else went wrong. Reviewed By: javache Differential Revision: D4918669 fbshipit-source-id: e95fa29e59dcdc40b57519e307b74c1f293da188
- Loading branch information...
Showing with 18 additions and 5 deletions.