fix: allow 0% snap points (#278)

This commit is contained in:
Richard Keenan
2021-02-14 22:35:35 +00:00
committed by GitHub
parent 7e34e30c5b
commit 2a62d269ac

View File

@@ -14,7 +14,8 @@ export const validateSnapPoint = (snapPoint: any) => {
invariant(
typeof snapPoint === 'number' ||
(typeof snapPoint === 'string' && Number(snapPoint.split('%')[0])),
(typeof snapPoint === 'string' &&
!Number.isNaN(Number(snapPoint.split('%')[0]))),
`'${snapPoint}' is not a valid percentage snap point! expected percentage snap point must be only numbers and '%'. e.g. '50%'`
);
};