Skip to content

Commit

Permalink
chore: changed all arrays to ReadonlyArray (#350)
Browse files Browse the repository at this point in the history
Co-authored-by: Ubax <jakub.tkacz@swmansion.com>
  • Loading branch information
Ubax and Ubax committed Mar 18, 2021
1 parent 257718f commit 3abe599
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/components/bottomSheet/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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>;
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useNormalizedSnapPoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
) =>
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useReactiveValues.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/normalizeSnapPoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 3abe599

Please sign in to comment.