Sanitize float value before calling setCameraDistance

Summary: Fixes the crash when calling setCameraDistance with NaN on Android Q.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D17170045

fbshipit-source-id: 386f969e70c56bca6ae5b8ffead62453ebb72857
This commit is contained in:
Oleg Lokhvitsky
2019-09-04 14:07:01 -07:00
committed by Facebook Github Bot
parent bf01dfbc97
commit d69387dac8
@@ -324,7 +324,8 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
// sqrt(5) produces an exact replica with iOS.
// For more information, see https://github.com/facebook/react-native/pull/18302
float normalizedCameraDistance =
scale * scale * cameraDistance * CAMERA_DISTANCE_NORMALIZATION_MULTIPLIER;
sanitizeFloatPropertyValue(
scale * scale * cameraDistance * CAMERA_DISTANCE_NORMALIZATION_MULTIPLIER);
view.setCameraDistance(normalizedCameraDistance);
}
}