mirror of
https://github.com/zhigang1992/react-native-bottom-sheet.git
synced 2026-01-12 22:50:12 +08:00
chore: changed all arrays to ReadonlyArray (#350)
Co-authored-by: Ubax <jakub.tkacz@swmansion.com>
This commit is contained in:
6
src/components/bottomSheet/types.d.ts
vendored
6
src/components/bottomSheet/types.d.ts
vendored
@@ -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>;
|
||||
|
||||
@@ -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
|
||||
) =>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user