16 lines
449 B
TypeScript
16 lines
449 B
TypeScript
import { PixelRatio } from "react-native";
|
|
import { logToSentry } from "../hooks/useSentryLogging";
|
|
|
|
export const getSizeInPx = (size: number) => {
|
|
return PixelRatio.getPixelSizeForLayoutSize(size);
|
|
};
|
|
|
|
export const getIndexFromOffset = (offset: number, SIZE: number) => {
|
|
if (SIZE === 0) {
|
|
logToSentry(
|
|
`Division by zero, offset: ${offset} | MethodName: getIndexFromOffset`
|
|
);
|
|
}
|
|
return Math.abs(Math.round(offset / SIZE));
|
|
};
|