react-native-reanimated-carousel 3.0.0 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -23
- package/README.zh-CN.md +62 -23
- package/lib/commonjs/ScrollViewGesture.js +1 -1
- package/lib/commonjs/ScrollViewGesture.js.map +1 -1
- package/lib/commonjs/hooks/useCarouselController.js +1 -1
- package/lib/commonjs/hooks/useCarouselController.js.map +1 -1
- package/lib/commonjs/hooks/useInitProps.js.map +1 -1
- package/lib/commonjs/hooks/useLayoutConfig.js.map +1 -1
- package/lib/commonjs/hooks/useOnProgressChange.js.map +1 -1
- package/lib/commonjs/hooks/usePropsErrorBoundary.js +1 -1
- package/lib/commonjs/hooks/usePropsErrorBoundary.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/layouts/BaseLayout.js.map +1 -1
- package/lib/commonjs/layouts/ParallaxLayout.js.map +1 -1
- package/lib/commonjs/layouts/parallax.js.map +1 -1
- package/lib/commonjs/layouts/stack.js.map +1 -1
- package/lib/commonjs/store/index.js.map +1 -1
- package/lib/commonjs/utils/computedWithAutoFillData.js.map +1 -1
- package/lib/module/ScrollViewGesture.js +9 -4
- package/lib/module/ScrollViewGesture.js.map +1 -1
- package/lib/module/hooks/useCarouselController.js +20 -8
- package/lib/module/hooks/useCarouselController.js.map +1 -1
- package/lib/module/hooks/useInitProps.js +1 -1
- package/lib/module/hooks/useInitProps.js.map +1 -1
- package/lib/module/hooks/useLayoutConfig.js.map +1 -1
- package/lib/module/hooks/useOnProgressChange.js +1 -1
- package/lib/module/hooks/useOnProgressChange.js.map +1 -1
- package/lib/module/hooks/usePropsErrorBoundary.js +1 -1
- package/lib/module/hooks/usePropsErrorBoundary.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/layouts/BaseLayout.js +1 -1
- package/lib/module/layouts/BaseLayout.js.map +1 -1
- package/lib/module/layouts/ParallaxLayout.js.map +1 -1
- package/lib/module/layouts/parallax.js.map +1 -1
- package/lib/module/layouts/stack.js.map +1 -1
- package/lib/module/store/index.js.map +1 -1
- package/lib/module/utils/computedWithAutoFillData.js +1 -1
- package/lib/module/utils/computedWithAutoFillData.js.map +1 -1
- package/lib/typescript/hooks/useLayoutConfig.d.ts +1 -1
- package/lib/typescript/hooks/usePropsErrorBoundary.d.ts +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/layouts/ParallaxLayout.d.ts +2 -2
- package/lib/typescript/layouts/parallax.d.ts +2 -2
- package/lib/typescript/layouts/stack.d.ts +2 -2
- package/lib/typescript/store/index.d.ts +1 -1
- package/lib/typescript/types.d.ts +1 -1
- package/package.json +16 -13
- package/src/ScrollViewGesture.tsx +17 -13
- package/src/hooks/useCarouselController.tsx +31 -7
- package/src/hooks/useInitProps.ts +1 -1
- package/src/hooks/useLayoutConfig.ts +1 -1
- package/src/hooks/useOnProgressChange.ts +1 -1
- package/src/hooks/usePropsErrorBoundary.ts +2 -2
- package/src/index.tsx +5 -1
- package/src/layouts/BaseLayout.tsx +1 -1
- package/src/layouts/ParallaxLayout.tsx +2 -2
- package/src/layouts/parallax.ts +2 -2
- package/src/layouts/stack.ts +2 -2
- package/src/store/index.ts +1 -1
- package/src/types.ts +1 -1
- package/src/utils/computedWithAutoFillData.ts +1 -1
|
@@ -2,7 +2,7 @@ import Animated, {
|
|
|
2
2
|
runOnJS,
|
|
3
3
|
useAnimatedReaction,
|
|
4
4
|
} from 'react-native-reanimated';
|
|
5
|
-
import { computedOffsetXValueWithAutoFillData } from '
|
|
5
|
+
import { computedOffsetXValueWithAutoFillData } from '../utils/computedWithAutoFillData';
|
|
6
6
|
import type { TCarouselProps } from '../types';
|
|
7
7
|
|
|
8
8
|
export function useOnProgressChange(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { TCarouselProps } from '
|
|
2
|
+
import type { TCarouselProps } from '../types';
|
|
3
3
|
|
|
4
4
|
export function usePropsErrorBoundary(props: TCarouselProps) {
|
|
5
5
|
React.useEffect(() => {
|
|
@@ -18,7 +18,7 @@ export function usePropsErrorBoundary(props: TCarouselProps) {
|
|
|
18
18
|
if (!props.mode || props.mode === 'parallax') {
|
|
19
19
|
if (!props.vertical && !props.width) {
|
|
20
20
|
throw Error(
|
|
21
|
-
'`width` must be specified for
|
|
21
|
+
'`width` must be specified for horizontal carousels.'
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
if (props.vertical && !props.height) {
|
package/src/index.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import Animated, {
|
|
|
7
7
|
useAnimatedStyle,
|
|
8
8
|
useDerivedValue,
|
|
9
9
|
} from 'react-native-reanimated';
|
|
10
|
-
import { useCheckMounted } from '
|
|
10
|
+
import { useCheckMounted } from '../hooks/useCheckMounted';
|
|
11
11
|
import { IOpts, useOffsetX } from '../hooks/useOffsetX';
|
|
12
12
|
import type { IVisibleRanges } from '../hooks/useVisibleRanges';
|
|
13
13
|
import { LazyView } from '../LazyView';
|
|
@@ -6,14 +6,14 @@ import Animated, {
|
|
|
6
6
|
useAnimatedReaction,
|
|
7
7
|
useAnimatedStyle,
|
|
8
8
|
} from 'react-native-reanimated';
|
|
9
|
-
import type {
|
|
9
|
+
import type { IComputedDirectionTypes } from '../types';
|
|
10
10
|
import { useOffsetX } from '../hooks/useOffsetX';
|
|
11
11
|
import type { IVisibleRanges } from '../hooks/useVisibleRanges';
|
|
12
12
|
import { LazyView } from '../LazyView';
|
|
13
13
|
import type { ILayoutConfig } from './parallax';
|
|
14
14
|
|
|
15
15
|
export const ParallaxLayout: React.FC<
|
|
16
|
-
|
|
16
|
+
IComputedDirectionTypes<
|
|
17
17
|
{
|
|
18
18
|
loop?: boolean;
|
|
19
19
|
handlerOffsetX: Animated.SharedValue<number>;
|
package/src/layouts/parallax.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Extrapolate, interpolate } from 'react-native-reanimated';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IComputedDirectionTypes } from '../types';
|
|
3
3
|
|
|
4
4
|
type TBaseConfig = {
|
|
5
5
|
size: number;
|
|
@@ -24,7 +24,7 @@ export interface ILayoutConfig {
|
|
|
24
24
|
parallaxAdjacentItemScale?: number;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export type TParallaxModeProps =
|
|
27
|
+
export type TParallaxModeProps = IComputedDirectionTypes<{
|
|
28
28
|
/**
|
|
29
29
|
* Carousel Animated transitions.
|
|
30
30
|
*/
|
package/src/layouts/stack.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { Dimensions, TransformsStyle, ViewStyle } from 'react-native';
|
|
3
3
|
import { Extrapolate, interpolate } from 'react-native-reanimated';
|
|
4
|
-
import type {
|
|
4
|
+
import type { IComputedDirectionTypes, CustomConfig } from '../types';
|
|
5
5
|
|
|
6
6
|
const screen = Dimensions.get('window');
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ export interface ILayoutConfig {
|
|
|
15
15
|
snapDirection?: 'left' | 'right';
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export type TStackModeProps =
|
|
18
|
+
export type TStackModeProps = IComputedDirectionTypes<{
|
|
19
19
|
/**
|
|
20
20
|
* Carousel Animated transitions.
|
|
21
21
|
*/
|
package/src/store/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type Animated from 'react-native-reanimated';
|
|
|
9
9
|
import type { TParallaxModeProps } from './layouts/parallax';
|
|
10
10
|
import type { TStackModeProps } from './layouts/stack';
|
|
11
11
|
|
|
12
|
-
export type
|
|
12
|
+
export type IComputedDirectionTypes<T, VP = {}, HP = {}> =
|
|
13
13
|
| (T &
|
|
14
14
|
VP & {
|
|
15
15
|
/**
|