File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 1+ import { roundToNearestPixel } from './roundToNearestPixel' ;
2+
13/**
24 * Converts a snap point to fixed numbers.
35 */
@@ -13,5 +15,8 @@ export const normalizeSnapPoint = (
1315 normalizedSnapPoint =
1416 ( Number ( normalizedSnapPoint . split ( '%' ) [ 0 ] ) * containerHeight ) / 100 ;
1517 }
16- return Math . max ( 0 , containerHeight - normalizedSnapPoint ) ;
18+ return Math . max (
19+ 0 ,
20+ roundToNearestPixel ( containerHeight - normalizedSnapPoint )
21+ ) ;
1722} ;
Original file line number Diff line number Diff line change 1+ import { PixelRatio } from 'react-native' ;
2+
3+ const PIXEL_DENSITY = PixelRatio . get ( ) ;
4+
5+ export function roundToNearestPixel ( position : number ) {
6+ 'worklet' ;
7+ return Math . round ( position * PIXEL_DENSITY ) / PIXEL_DENSITY ;
8+ }
You can’t perform that action at this time.
0 commit comments