chore: changed all arrays to ReadonlyArray (#350)

Co-authored-by: Ubax <jakub.tkacz@swmansion.com>
This commit is contained in:
Jakub Tkacz
2021-03-18 01:06:01 +01:00
committed by GitHub
parent 257718f6c4
commit 3abe59909d
4 changed files with 6 additions and 6 deletions

View File

@@ -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<string | number>
* @type ReadonlyArray<string | number>
* @example
* snapPoints={[200, 500]}
* snapPoints={[200, '50%']}
* snapPoints={[-1, '100%']}
*/
snapPoints: Array<string | number>;
snapPoints: ReadonlyArray<string | number>;
/**
* 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<number>;
scrollableContentOffsetY: Animated.Value<number>;
snapPoints: number[];
snapPoints: ReadonlyArray<number>;
initialPosition: number;
currentIndexRef: React.RefObject<number>;

View File

@@ -2,7 +2,7 @@ import { useMemo } from 'react';
import { normalizeSnapPoints } from '../utilities';
export const useNormalizedSnapPoints = (
snapPoints: Array<number | string>,
snapPoints: ReadonlyArray<number | string>,
containerHeight: number = 0,
handleHeight: number = 0
) =>

View File

@@ -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<number>) => {
// ref
const ref = useRef<Animated.Value<number>[]>(null);
if (ref.current === null) {

View File

@@ -4,7 +4,7 @@ import { validateSnapPoint } from './validateSnapPoint';
* Converts snap points with percentage to fixed numbers.
*/
export const normalizeSnapPoints = (
snapPoints: Array<number | string>,
snapPoints: ReadonlyArray<number | string>,
containerHeight: number
) =>
snapPoints.map(snapPoint => {