Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: changes all arrays to ReadonlyArray #350

Merged
merged 1 commit into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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