Skip to content

Commit 3abe599

Browse files
UbaxUbax
andauthored
chore: changed all arrays to ReadonlyArray (#350)
Co-authored-by: Ubax <[email protected]>
1 parent 257718f commit 3abe599

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/components/bottomSheet/types.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ export type BottomSheetProps = {
1616
/**
1717
* Points for the bottom sheet to snap to. It accepts array of number, string or mix.
1818
* String values should be a percentage.
19-
* @type Array<string | number>
19+
* @type ReadonlyArray<string | number>
2020
* @example
2121
* snapPoints={[200, 500]}
2222
* snapPoints={[200, '50%']}
2323
* snapPoints={[-1, '100%']}
2424
*/
25-
snapPoints: Array<string | number>;
25+
snapPoints: ReadonlyArray<string | number>;
2626
/**
2727
* Handle height helps to calculate the internal container and sheet layouts,
2828
* if `handleComponent` is provided, the library internally will calculate its layout,
@@ -171,7 +171,7 @@ export interface BottomSheetTransitionConfig
171171
handlePanGestureVelocityY: Animated.Value<number>;
172172

173173
scrollableContentOffsetY: Animated.Value<number>;
174-
snapPoints: number[];
174+
snapPoints: ReadonlyArray<number>;
175175
initialPosition: number;
176176

177177
currentIndexRef: React.RefObject<number>;

src/hooks/useNormalizedSnapPoints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useMemo } from 'react';
22
import { normalizeSnapPoints } from '../utilities';
33

44
export const useNormalizedSnapPoints = (
5-
snapPoints: Array<number | string>,
5+
snapPoints: ReadonlyArray<number | string>,
66
containerHeight: number = 0,
77
handleHeight: number = 0
88
) =>

src/hooks/useReactiveValues.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useRef } from 'react';
22
import Animated from 'react-native-reanimated';
33

4-
export const useReactiveValues = (values: number[]) => {
4+
export const useReactiveValues = (values: ReadonlyArray<number>) => {
55
// ref
66
const ref = useRef<Animated.Value<number>[]>(null);
77
if (ref.current === null) {

src/utilities/normalizeSnapPoints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { validateSnapPoint } from './validateSnapPoint';
44
* Converts snap points with percentage to fixed numbers.
55
*/
66
export const normalizeSnapPoints = (
7-
snapPoints: Array<number | string>,
7+
snapPoints: ReadonlyArray<number | string>,
88
containerHeight: number
99
) =>
1010
snapPoints.map(snapPoint => {

0 commit comments

Comments
 (0)