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:
asmockler 2016-01-25 06:00:26 -08:00 коммит произвёл facebook-github-bot-9
Родитель c95d74ac09
Коммит dad462258f
1 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -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',