Skip to content

Commit

Permalink
fix: allow 0% snap points (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
richkeenan committed Feb 14, 2021
1 parent 7e34e30 commit 2a62d26
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utilities/validateSnapPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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%'`
);
};

0 comments on commit 2a62d26

Please sign in to comment.