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.
Files changed (61) hide show
  1. package/README.md +65 -23
  2. package/README.zh-CN.md +62 -23
  3. package/lib/commonjs/ScrollViewGesture.js +1 -1
  4. package/lib/commonjs/ScrollViewGesture.js.map +1 -1
  5. package/lib/commonjs/hooks/useCarouselController.js +1 -1
  6. package/lib/commonjs/hooks/useCarouselController.js.map +1 -1
  7. package/lib/commonjs/hooks/useInitProps.js.map +1 -1
  8. package/lib/commonjs/hooks/useLayoutConfig.js.map +1 -1
  9. package/lib/commonjs/hooks/useOnProgressChange.js.map +1 -1
  10. package/lib/commonjs/hooks/usePropsErrorBoundary.js +1 -1
  11. package/lib/commonjs/hooks/usePropsErrorBoundary.js.map +1 -1
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/layouts/BaseLayout.js.map +1 -1
  14. package/lib/commonjs/layouts/ParallaxLayout.js.map +1 -1
  15. package/lib/commonjs/layouts/parallax.js.map +1 -1
  16. package/lib/commonjs/layouts/stack.js.map +1 -1
  17. package/lib/commonjs/store/index.js.map +1 -1
  18. package/lib/commonjs/utils/computedWithAutoFillData.js.map +1 -1
  19. package/lib/module/ScrollViewGesture.js +9 -4
  20. package/lib/module/ScrollViewGesture.js.map +1 -1
  21. package/lib/module/hooks/useCarouselController.js +20 -8
  22. package/lib/module/hooks/useCarouselController.js.map +1 -1
  23. package/lib/module/hooks/useInitProps.js +1 -1
  24. package/lib/module/hooks/useInitProps.js.map +1 -1
  25. package/lib/module/hooks/useLayoutConfig.js.map +1 -1
  26. package/lib/module/hooks/useOnProgressChange.js +1 -1
  27. package/lib/module/hooks/useOnProgressChange.js.map +1 -1
  28. package/lib/module/hooks/usePropsErrorBoundary.js +1 -1
  29. package/lib/module/hooks/usePropsErrorBoundary.js.map +1 -1
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/module/layouts/BaseLayout.js +1 -1
  32. package/lib/module/layouts/BaseLayout.js.map +1 -1
  33. package/lib/module/layouts/ParallaxLayout.js.map +1 -1
  34. package/lib/module/layouts/parallax.js.map +1 -1
  35. package/lib/module/layouts/stack.js.map +1 -1
  36. package/lib/module/store/index.js.map +1 -1
  37. package/lib/module/utils/computedWithAutoFillData.js +1 -1
  38. package/lib/module/utils/computedWithAutoFillData.js.map +1 -1
  39. package/lib/typescript/hooks/useLayoutConfig.d.ts +1 -1
  40. package/lib/typescript/hooks/usePropsErrorBoundary.d.ts +1 -1
  41. package/lib/typescript/index.d.ts +1 -1
  42. package/lib/typescript/layouts/ParallaxLayout.d.ts +2 -2
  43. package/lib/typescript/layouts/parallax.d.ts +2 -2
  44. package/lib/typescript/layouts/stack.d.ts +2 -2
  45. package/lib/typescript/store/index.d.ts +1 -1
  46. package/lib/typescript/types.d.ts +1 -1
  47. package/package.json +16 -13
  48. package/src/ScrollViewGesture.tsx +17 -13
  49. package/src/hooks/useCarouselController.tsx +31 -7
  50. package/src/hooks/useInitProps.ts +1 -1
  51. package/src/hooks/useLayoutConfig.ts +1 -1
  52. package/src/hooks/useOnProgressChange.ts +1 -1
  53. package/src/hooks/usePropsErrorBoundary.ts +2 -2
  54. package/src/index.tsx +5 -1
  55. package/src/layouts/BaseLayout.tsx +1 -1
  56. package/src/layouts/ParallaxLayout.tsx +2 -2
  57. package/src/layouts/parallax.ts +2 -2
  58. package/src/layouts/stack.ts +2 -2
  59. package/src/store/index.ts +1 -1
  60. package/src/types.ts +1 -1
  61. package/src/utils/computedWithAutoFillData.ts +1 -1
@@ -1,4 +1,4 @@
1
- import { computedFillDataWithAutoFillData } from '@/utils/computedWithAutoFillData';
1
+ import { computedFillDataWithAutoFillData } from '../utils/computedWithAutoFillData';
2
2
  import React from 'react';
3
3
  import type { TCarouselProps } from '../types';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { TAnimationStyle } from 'src/layouts/BaseLayout';
2
+ import type { TAnimationStyle } from '../layouts/BaseLayout';
3
3
  import { Layouts } from '../layouts';
4
4
  import type { TInitializeCarouselProps } from './useInitProps';
5
5
 
@@ -2,7 +2,7 @@ import Animated, {
2
2
  runOnJS,
3
3
  useAnimatedReaction,
4
4
  } from 'react-native-reanimated';
5
- import { computedOffsetXValueWithAutoFillData } from '@/utils/computedWithAutoFillData';
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 'src/types';
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 vertical carousels.'
21
+ '`width` must be specified for horizontal carousels.'
22
22
  );
23
23
  }
24
24
  if (props.vertical && !props.height) {
package/src/index.tsx CHANGED
@@ -1,4 +1,8 @@
1
- export type { TCarouselProps, ICarouselInstance } from './types';
1
+ export type {
2
+ TCarouselProps,
3
+ ICarouselInstance,
4
+ IComputedDirectionTypes,
5
+ } from './types';
2
6
  import Carousel from './Carousel';
3
7
 
4
8
  export default Carousel;
@@ -7,7 +7,7 @@ import Animated, {
7
7
  useAnimatedStyle,
8
8
  useDerivedValue,
9
9
  } from 'react-native-reanimated';
10
- import { useCheckMounted } from 'src/hooks/useCheckMounted';
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 { ComputedDirectionTypes } from 'src/types';
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
- ComputedDirectionTypes<
16
+ IComputedDirectionTypes<
17
17
  {
18
18
  loop?: boolean;
19
19
  handlerOffsetX: Animated.SharedValue<number>;
@@ -1,5 +1,5 @@
1
1
  import { Extrapolate, interpolate } from 'react-native-reanimated';
2
- import type { ComputedDirectionTypes } from '../types';
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 = ComputedDirectionTypes<{
27
+ export type TParallaxModeProps = IComputedDirectionTypes<{
28
28
  /**
29
29
  * Carousel Animated transitions.
30
30
  */
@@ -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 { ComputedDirectionTypes, CustomConfig } from '../types';
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 = ComputedDirectionTypes<{
18
+ export type TStackModeProps = IComputedDirectionTypes<{
19
19
  /**
20
20
  * Carousel Animated transitions.
21
21
  */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { TInitializeCarouselProps } from 'src/hooks/useInitProps';
2
+ import type { TInitializeCarouselProps } from '../hooks/useInitProps';
3
3
 
4
4
  export interface IContext {
5
5
  props: TInitializeCarouselProps<any>;
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 ComputedDirectionTypes<T, VP = {}, HP = {}> =
12
+ export type IComputedDirectionTypes<T, VP = {}, HP = {}> =
13
13
  | (T &
14
14
  VP & {
15
15
  /**
@@ -1,4 +1,4 @@
1
- import { DATA_LENGTH } from 'src/constants';
1
+ import { DATA_LENGTH } from '../constants';
2
2
 
3
3
  const { SINGLE_ITEM, DOUBLE_ITEM } = DATA_LENGTH;
4
4