constants.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import React from "react"
  2. import { StyleProp, ViewStyle } from 'react-native';
  3. import { Easing, SharedValue, EasingFn } from 'react-native-reanimated';
  4. type _animationType = 'none' | 'shiver' | 'pulse' | undefined;
  5. type _animationDirection =
  6. | 'horizontalLeft'
  7. | 'horizontalRight'
  8. | 'verticalTop'
  9. | 'verticalDown'
  10. | 'diagonalDownLeft'
  11. | 'diagonalDownRight'
  12. | 'diagonalTopLeft'
  13. | 'diagonalTopRight'
  14. | undefined;
  15. export interface ICustomViewStyle extends ViewStyle {
  16. children?: ICustomViewStyle[];
  17. key?: number | string;
  18. }
  19. export interface ISkeletonProps {
  20. isLoading: boolean;
  21. layout?: ICustomViewStyle[];
  22. duration?: number;
  23. containerStyle?: StyleProp<ViewStyle>;
  24. animationType?: _animationType;
  25. animationDirection?: _animationDirection;
  26. boneColor?: string | undefined;
  27. hasFadeIn?: boolean;
  28. highlightColor?: string | undefined;
  29. easing?: { factory: () => EasingFn };
  30. children?: React.ReactNode;
  31. }
  32. export interface IComponentSize {
  33. width: number;
  34. height: number;
  35. }
  36. export interface IGeneralStyles {
  37. animationDirection: _animationDirection;
  38. animationType: _animationType;
  39. boneColor: string;
  40. highlightColor: string;
  41. animationValue: SharedValue<number>;
  42. }
  43. export interface IDirection {
  44. x: number;
  45. y: number;
  46. }
  47. export const DEFAULT_CONFIG = {
  48. BORDER_RADIUS: 3,
  49. DURATION: 1200,
  50. ANIMATION_TYPE: 'shiver' as _animationType,
  51. ANIMATION_DIRECTION: 'horizontalLeft' as _animationDirection,
  52. BONE_COLOR: '#E1E9EE',
  53. HIGHLIGHT_COLOR: '#F2F8FC',
  54. EASING: Easing.bezier(0.5, 0, 0.25, 1),
  55. LOADING: true,
  56. };