diff --git a/src/components/bottomSheet/types.d.ts b/src/components/bottomSheet/types.d.ts index 6f6fefb2c..c63dacc67 100644 --- a/src/components/bottomSheet/types.d.ts +++ b/src/components/bottomSheet/types.d.ts @@ -16,13 +16,13 @@ export type BottomSheetProps = { /** * Points for the bottom sheet to snap to. It accepts array of number, string or mix. * String values should be a percentage. - * @type Array + * @type ReadonlyArray * @example * snapPoints={[200, 500]} * snapPoints={[200, '50%']} * snapPoints={[-1, '100%']} */ - snapPoints: Array; + snapPoints: ReadonlyArray; /** * Handle height helps to calculate the internal container and sheet layouts, * if `handleComponent` is provided, the library internally will calculate its layout, @@ -171,7 +171,7 @@ export interface BottomSheetTransitionConfig handlePanGestureVelocityY: Animated.Value; scrollableContentOffsetY: Animated.Value; - snapPoints: number[]; + snapPoints: ReadonlyArray; initialPosition: number; currentIndexRef: React.RefObject; diff --git a/src/hooks/useNormalizedSnapPoints.ts b/src/hooks/useNormalizedSnapPoints.ts index 46c95284c..5b1f2d915 100644 --- a/src/hooks/useNormalizedSnapPoints.ts +++ b/src/hooks/useNormalizedSnapPoints.ts @@ -2,7 +2,7 @@ import { useMemo } from 'react'; import { normalizeSnapPoints } from '../utilities'; export const useNormalizedSnapPoints = ( - snapPoints: Array, + snapPoints: ReadonlyArray, containerHeight: number = 0, handleHeight: number = 0 ) => diff --git a/src/hooks/useReactiveValues.ts b/src/hooks/useReactiveValues.ts index dc286951d..494a958c4 100644 --- a/src/hooks/useReactiveValues.ts +++ b/src/hooks/useReactiveValues.ts @@ -1,7 +1,7 @@ import { useEffect, useRef } from 'react'; import Animated from 'react-native-reanimated'; -export const useReactiveValues = (values: number[]) => { +export const useReactiveValues = (values: ReadonlyArray) => { // ref const ref = useRef[]>(null); if (ref.current === null) { diff --git a/src/utilities/normalizeSnapPoints.ts b/src/utilities/normalizeSnapPoints.ts index 9fff11744..5efc7e64b 100644 --- a/src/utilities/normalizeSnapPoints.ts +++ b/src/utilities/normalizeSnapPoints.ts @@ -4,7 +4,7 @@ import { validateSnapPoint } from './validateSnapPoint'; * Converts snap points with percentage to fixed numbers. */ export const normalizeSnapPoints = ( - snapPoints: Array, + snapPoints: ReadonlyArray, containerHeight: number ) => snapPoints.map(snapPoint => {