mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 23:55:23 +00:00
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](96553cf553/Libraries/Utilities/MatrixMath.js (L118)
).
See issue #2616
Closes https://github.com/facebook/react-native/pull/5457
Reviewed By: svcscm
Differential Revision: D2851748
Pulled By: bestander
fb-gh-sync-id: d2872fb73b4d95ba0b6e5ed2bee814158645cf73
This commit is contained in:
parent
c95d74ac09
commit
dad462258f
@ -165,6 +165,20 @@ function _validateTransform(key, value, transformation) {
|
||||
stringifySafe(transformation),
|
||||
);
|
||||
break;
|
||||
case 'perspective':
|
||||
invariant(
|
||||
typeof value === 'number',
|
||||
'Transform with key of "%s" must be a number: %s',
|
||||
key,
|
||||
stringifySafe(transformation),
|
||||
);
|
||||
invariant(
|
||||
value !== 0,
|
||||
'Transform with key of "%s" cannot be zero: %s',
|
||||
key,
|
||||
stringifySafe(transformation),
|
||||
);
|
||||
break;
|
||||
default:
|
||||
invariant(
|
||||
typeof value === 'number',
|
||||
|
Loading…
x
Reference in New Issue
Block a user