@hero-design/rn 8.24.0 → 8.25.1

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 (29) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/es/index.js +111 -60
  3. package/lib/index.js +110 -59
  4. package/package.json +5 -5
  5. package/src/components/Carousel/CardCarousel.tsx +23 -7
  6. package/src/components/Carousel/__tests__/CardCarousel.spec.tsx +177 -70
  7. package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +294 -1
  8. package/src/components/Collapse/index.tsx +11 -10
  9. package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +21 -15
  10. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +7 -5
  11. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +7 -5
  12. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +7 -5
  13. package/src/components/Error/StyledError.tsx +2 -0
  14. package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +8 -0
  15. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +28 -20
  16. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +28 -20
  17. package/src/components/Spinner/AnimatedSpinner.tsx +2 -2
  18. package/src/components/TextInput/StyledTextInput.tsx +4 -0
  19. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +21 -1
  20. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +112 -78
  21. package/src/components/TextInput/index.tsx +1 -4
  22. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +14 -10
  23. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +14 -10
  24. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +9 -1
  25. package/src/theme/components/error.ts +6 -1
  26. package/src/theme/components/textInput.ts +16 -2
  27. package/types/components/Collapse/index.d.ts +1 -1
  28. package/types/theme/components/error.d.ts +4 -0
  29. package/types/theme/components/textInput.d.ts +4 -0
package/lib/index.js CHANGED
@@ -1011,9 +1011,9 @@ var blue$1 = colorScales.blue,
1011
1011
  purple$1 = colorScales.purple,
1012
1012
  vermilion$3 = colorScales.vermilion,
1013
1013
  smalt = colorScales.smalt,
1014
- violet$1 = colorScales.violet,
1014
+ violet$2 = colorScales.violet,
1015
1015
  yellow$1 = colorScales.yellow;
1016
- ({
1016
+ var palette$b = {
1017
1017
  black: '#000000',
1018
1018
  white: '#ffffff',
1019
1019
  blue: blue$1.base,
@@ -1088,21 +1088,40 @@ var blue$1 = colorScales.blue,
1088
1088
  smaltLight45: smalt.lighten45,
1089
1089
  smaltLight75: smalt.lighten75,
1090
1090
  smaltLight90: smalt.lighten90,
1091
- violet: violet$1.base,
1092
- violetDark15: violet$1.darken15,
1093
- violetDark30: violet$1.darken30,
1094
- violetDark45: violet$1.darken45,
1095
- violetDark60: violet$1.darken60,
1096
- violetDark75: violet$1.darken75,
1097
- violetLight30: violet$1.lighten30,
1098
- violetLight60: violet$1.lighten60,
1099
- violetLight75: violet$1.lighten75,
1100
- violetLight90: violet$1.lighten90,
1091
+ violet: violet$2.base,
1092
+ violetDark15: violet$2.darken15,
1093
+ violetDark30: violet$2.darken30,
1094
+ violetDark45: violet$2.darken45,
1095
+ violetDark60: violet$2.darken60,
1096
+ violetDark75: violet$2.darken75,
1097
+ violetLight30: violet$2.lighten30,
1098
+ violetLight60: violet$2.lighten60,
1099
+ violetLight75: violet$2.lighten75,
1100
+ violetLight90: violet$2.lighten90,
1101
1101
  yellow: yellow$1.base,
1102
1102
  yellowDark15: yellow$1.darken15,
1103
1103
  yellowDark75: yellow$1.darken75,
1104
+ yellowLight45: yellow$1.lighten45,
1104
1105
  yellowLight60: yellow$1.lighten60,
1106
+ yellowLight75: yellow$1.lighten75,
1105
1107
  yellowLight90: yellow$1.lighten90
1108
+ };
1109
+ var mauve$4 = colorScales.mauve,
1110
+ violet$1 = colorScales.violet;
1111
+ Object.assign(Object.assign({}, palette$b), {
1112
+ mauve: mauve$4.base,
1113
+ mauveLight80: mauve$4.lighten80,
1114
+ violetDark50: violet$1.darken50
1115
+ });
1116
+ var apple$4 = colorScales.apple,
1117
+ hitPink$1 = colorScales.hitPink;
1118
+ Object.assign(Object.assign({}, palette$b), {
1119
+ apple: apple$4.base,
1120
+ appleDark20: apple$4.darken20,
1121
+ appleDark50: apple$4.darken50,
1122
+ appleLight90: apple$4.lighten90,
1123
+ hitPink: hitPink$1.base,
1124
+ hitPinkLight80: hitPink$1.lighten80
1106
1125
  });
1107
1126
  var aliceBlue$1 = colorScales.aliceBlue,
1108
1127
  antiFlashWhite$1 = colorScales.antiFlashWhite,
@@ -1269,7 +1288,7 @@ var currant$1 = colorScales.currant,
1269
1288
  vermilion = colorScales.vermilion,
1270
1289
  mauve$3 = colorScales.mauve,
1271
1290
  violet1$3 = colorScales.violet1,
1272
- violet$2 = colorScales.violet,
1291
+ violet$3 = colorScales.violet,
1273
1292
  scarletGum$2 = colorScales.scarletGum;
1274
1293
  var palette$6 = {
1275
1294
  currant: currant$1.base,
@@ -1288,9 +1307,9 @@ var palette$6 = {
1288
1307
  pastelRed: pastelRed.base,
1289
1308
  vermilion: vermilion.base,
1290
1309
  mauve: mauve$3.base,
1291
- violetLight30: violet$2.lighten30,
1310
+ violetLight30: violet$3.lighten30,
1292
1311
  violet1: violet1$3.base,
1293
- violet: violet$2.base,
1312
+ violet: violet$3.base,
1294
1313
  scarletGum: scarletGum$2.base
1295
1314
  };
1296
1315
  var violet1$2 = colorScales.violet1,
@@ -2270,12 +2289,17 @@ var getErrorTheme = function getErrorTheme(theme) {
2270
2289
  title: theme.fonts.playful.semiBold,
2271
2290
  description: theme.fonts.playful.regular
2272
2291
  };
2292
+ var lineHeight = {
2293
+ title: theme.lineHeights.xxxlarge,
2294
+ description: theme.lineHeights.xlarge
2295
+ };
2273
2296
  return {
2274
2297
  fontSizes: fontSizes,
2275
2298
  colors: colors,
2276
2299
  sizes: sizes,
2277
2300
  space: space,
2278
- fonts: fonts
2301
+ fonts: fonts,
2302
+ lineHeight: lineHeight
2279
2303
  };
2280
2304
  };
2281
2305
 
@@ -2937,7 +2961,7 @@ var getTextInputTheme = function getTextInputTheme(theme) {
2937
2961
  var space = {
2938
2962
  containerPadding: theme.space.medium,
2939
2963
  labelLeft: theme.space.medium,
2940
- labelTop: theme.lineHeights.small / -2,
2964
+ labelTop: theme.lineHeights.small / -4,
2941
2965
  labelPaddingBottom: theme.space.small,
2942
2966
  labelHorizontalPadding: theme.space.xsmall,
2943
2967
  inputHorizontalMargin: theme.space.small,
@@ -2956,7 +2980,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
2956
2980
  labelInsideTextInput: theme.fontSizes.large,
2957
2981
  error: theme.fontSizes.small,
2958
2982
  maxLength: theme.fontSizes.small,
2959
- asteriskLabel: theme.fontSizes.large
2983
+ asteriskLabel: theme.fontSizes.large,
2984
+ topLabel: theme.fontSizes.small
2960
2985
  };
2961
2986
  var borderWidths = {
2962
2987
  container: {
@@ -2972,6 +2997,9 @@ var getTextInputTheme = function getTextInputTheme(theme) {
2972
2997
  textareaHeight: theme.sizes['15xlarge'],
2973
2998
  textInputMaxHeight: theme.sizes['15xlarge']
2974
2999
  };
3000
+ var lineHeights = {
3001
+ topLabel: theme.lineHeights.large / 2
3002
+ };
2975
3003
  return {
2976
3004
  colors: colors,
2977
3005
  space: space,
@@ -2979,7 +3007,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
2979
3007
  fontSizes: fontSizes,
2980
3008
  borderWidths: borderWidths,
2981
3009
  radii: radii,
2982
- sizes: sizes
3010
+ sizes: sizes,
3011
+ lineHeights: lineHeights
2983
3012
  };
2984
3013
  };
2985
3014
 
@@ -6035,26 +6064,6 @@ var index$a = components.reduce(function (acc, comp) {
6035
6064
  });
6036
6065
  }, styled);
6037
6066
 
6038
- var StyledWrapper$c = index$a(reactNative.Animated.View)({
6039
- margin: 0,
6040
- padding: 0,
6041
- overflow: 'hidden'
6042
- });
6043
- /**
6044
- * Height need to be high enough to cover most scenario
6045
- * This container's purpose is only to help get correct children height and returns it
6046
- * to use with Animated.timing
6047
- */
6048
- var StyledHiddenWrapper = index$a(reactNative.View)(function () {
6049
- return {
6050
- height: reactNative.Dimensions.get('window').height
6051
- };
6052
- });
6053
- var StyledChildWrapper = index$a(reactNative.View)({
6054
- margin: 0,
6055
- padding: 0
6056
- });
6057
-
6058
6067
  // Get previous state value
6059
6068
  var usePrevious = function usePrevious(value) {
6060
6069
  var ref = React__default["default"].useRef();
@@ -6080,13 +6089,37 @@ var useDeprecation = function useDeprecation(message) {
6080
6089
  }, [message, cond]);
6081
6090
  };
6082
6091
 
6092
+ var StyledWrapper$c = index$a(reactNative.Animated.View)({
6093
+ margin: 0,
6094
+ padding: 0,
6095
+ overflow: 'hidden'
6096
+ });
6097
+ /**
6098
+ * Height need to be high enough to cover most scenario
6099
+ * This container's purpose is only to help get correct children height and returns it
6100
+ * to use with Animated.timing
6101
+ */
6102
+ var StyledHiddenWrapper = index$a(reactNative.View)(function () {
6103
+ return {
6104
+ height: reactNative.Dimensions.get('window').height
6105
+ };
6106
+ });
6107
+ var StyledChildWrapper = index$a(reactNative.View)({
6108
+ margin: 0,
6109
+ padding: 0
6110
+ });
6111
+
6112
+ if (reactNative.Platform.OS === 'android') {
6113
+ if (reactNative.UIManager.setLayoutAnimationEnabledExperimental) {
6114
+ reactNative.UIManager.setLayoutAnimationEnabledExperimental(true);
6115
+ }
6116
+ }
6083
6117
  var Collapse = function Collapse(_ref) {
6084
6118
  var _ref$open = _ref.open,
6085
6119
  open = _ref$open === void 0 ? false : _ref$open,
6086
6120
  children = _ref.children,
6087
6121
  testID = _ref.testID,
6088
6122
  style = _ref.style;
6089
- var collapseAnim = React__default["default"].useRef(new reactNative.Animated.Value(0)).current;
6090
6123
  var _React$useState = React__default["default"].useState(0),
6091
6124
  _React$useState2 = _slicedToArray(_React$useState, 2),
6092
6125
  contentHeight = _React$useState2[0],
@@ -6094,11 +6127,7 @@ var Collapse = function Collapse(_ref) {
6094
6127
  var previousOpenState = usePrevious(open);
6095
6128
  React.useEffect(function () {
6096
6129
  if (open !== previousOpenState && previousOpenState !== undefined || open) {
6097
- reactNative.Animated.timing(collapseAnim, {
6098
- toValue: open ? contentHeight : 0,
6099
- easing: reactNative.Easing.inOut(reactNative.Easing.cubic),
6100
- useNativeDriver: false
6101
- }).start();
6130
+ reactNative.LayoutAnimation.configureNext(reactNative.LayoutAnimation.Presets.easeInEaseOut);
6102
6131
  }
6103
6132
  }, [open, previousOpenState, contentHeight]);
6104
6133
  var fetchMaxHeight = React.useCallback(function (_ref2) {
@@ -6107,7 +6136,7 @@ var Collapse = function Collapse(_ref) {
6107
6136
  }, []);
6108
6137
  return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$c, {
6109
6138
  style: {
6110
- height: collapseAnim
6139
+ height: open ? contentHeight : 0
6111
6140
  },
6112
6141
  testID: testID
6113
6142
  }, /*#__PURE__*/React__default["default"].createElement(StyledHiddenWrapper, null, /*#__PURE__*/React__default["default"].createElement(StyledChildWrapper, {
@@ -11319,6 +11348,7 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
11319
11348
  setFlatListWidth = _useState4[1];
11320
11349
  var itemWidth = flatListWidth * ITEM_WIDTH_RATE;
11321
11350
  var carouselRef = React.useRef(null);
11351
+ var viewPosition = reactNative.Platform.OS === 'ios' ? VIEW_POSITION_CENTER : undefined;
11322
11352
  var _snapToIndex = React.useCallback(function (index) {
11323
11353
  var _carouselRef$current;
11324
11354
  var validIndex = 0;
@@ -11332,7 +11362,7 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
11332
11362
  (_carouselRef$current = carouselRef.current) === null || _carouselRef$current === void 0 ? void 0 : _carouselRef$current.scrollToIndex({
11333
11363
  index: validIndex,
11334
11364
  animated: true,
11335
- viewPosition: VIEW_POSITION_CENTER
11365
+ viewPosition: viewPosition
11336
11366
  });
11337
11367
  }, [carouselRef, itemWidth]);
11338
11368
  /*
@@ -11347,7 +11377,7 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
11347
11377
  (_carouselRef$current2 = carouselRef.current) === null || _carouselRef$current2 === void 0 ? void 0 : _carouselRef$current2.scrollToIndex({
11348
11378
  index: nextIndex,
11349
11379
  animated: true,
11350
- viewPosition: VIEW_POSITION_CENTER
11380
+ viewPosition: viewPosition
11351
11381
  });
11352
11382
  }, [carouselRef, currentIndex, itemWidth, items.length]);
11353
11383
  React__default["default"].useImperativeHandle(ref, function () {
@@ -11402,16 +11432,31 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
11402
11432
  }
11403
11433
  }, /*#__PURE__*/React__default["default"].createElement(StyledShadow, null, /*#__PURE__*/React__default["default"].createElement(StyledCard, null, item)));
11404
11434
  }, [itemWidth]);
11435
+ var contentContainerPaddingHorizontal = theme.__hd__.cardCarousel.space.contentContainerPaddingHorizontal;
11405
11436
  return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$7, {
11406
11437
  style: style,
11407
11438
  testID: testID
11408
11439
  }, /*#__PURE__*/React__default["default"].createElement(reactNative.FlatList, {
11409
11440
  contentInset: {
11410
11441
  top: 0,
11411
- left: theme.__hd__.cardCarousel.space.contentContainerPaddingHorizontal,
11442
+ left: contentContainerPaddingHorizontal,
11412
11443
  bottom: 0,
11413
- right: theme.__hd__.cardCarousel.space.contentContainerPaddingHorizontal
11444
+ right: contentContainerPaddingHorizontal
11414
11445
  },
11446
+ ListHeaderComponent: reactNative.Platform.select({
11447
+ android: /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
11448
+ style: {
11449
+ width: contentContainerPaddingHorizontal
11450
+ }
11451
+ })
11452
+ }),
11453
+ ListFooterComponent: reactNative.Platform.select({
11454
+ android: /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
11455
+ style: {
11456
+ width: contentContainerPaddingHorizontal
11457
+ }
11458
+ })
11459
+ }),
11415
11460
  onLayout: flatListOnLayout,
11416
11461
  data: items,
11417
11462
  horizontal: true,
@@ -11428,7 +11473,9 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
11428
11473
  },
11429
11474
  decelerationRate: "fast",
11430
11475
  renderToHardwareTextureAndroid: true,
11431
- snapToInterval: itemWidth,
11476
+ snapToInterval: reactNative.Platform.select({
11477
+ ios: itemWidth
11478
+ }),
11432
11479
  onViewableItemsChanged: visibleSlideChanged,
11433
11480
  viewabilityConfig: {
11434
11481
  itemVisiblePercentThreshold: 80
@@ -11653,14 +11700,18 @@ var StyledLabel = index$a(Typography.Text)(function (_ref3) {
11653
11700
  var theme = _ref3.theme,
11654
11701
  themeState = _ref3.themeState;
11655
11702
  return {
11656
- color: theme.__hd__.textInput.colors.labels[themeState]
11703
+ color: theme.__hd__.textInput.colors.labels[themeState],
11704
+ fontSize: theme.__hd__.textInput.fontSizes.topLabel,
11705
+ lineHeight: theme.__hd__.textInput.lineHeights.topLabel
11657
11706
  };
11658
11707
  });
11659
11708
  var StyledAsteriskLabel = index$a(Typography.Text)(function (_ref4) {
11660
11709
  var theme = _ref4.theme,
11661
11710
  themeState = _ref4.themeState;
11662
11711
  return {
11663
- color: theme.__hd__.textInput.colors.asterisks[themeState]
11712
+ color: theme.__hd__.textInput.colors.asterisks[themeState],
11713
+ fontSize: theme.__hd__.textInput.fontSizes.topLabel,
11714
+ lineHeight: theme.__hd__.textInput.lineHeights.topLabel
11664
11715
  };
11665
11716
  });
11666
11717
  var StyledLabelContainerInsideTextInput = index$a(reactNative.View)(function (_ref5) {
@@ -11968,12 +12019,10 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
11968
12019
  backgroundColor: backgroundColor
11969
12020
  }
11970
12021
  }, required && /*#__PURE__*/React__default["default"].createElement(StyledAsteriskLabel, {
11971
- themeState: state,
11972
- fontSize: "small"
12022
+ themeState: state
11973
12023
  }, "*"), !!label && /*#__PURE__*/React__default["default"].createElement(StyledLabel, {
11974
12024
  nativeID: accessibilityLabelledBy,
11975
12025
  testID: "input-label",
11976
- fontSize: "small",
11977
12026
  themeState: state,
11978
12027
  style: {
11979
12028
  backgroundColor: backgroundColor
@@ -12697,7 +12746,8 @@ var StyledErrorTitle = index$a(Typography.Text)(function (_ref8) {
12697
12746
  fontSize: theme.__hd__.error.fontSizes.title,
12698
12747
  textAlign: 'center',
12699
12748
  marginBottom: theme.__hd__.error.space.titleMarginBottom,
12700
- color: theme.__hd__.error.colors.title
12749
+ color: theme.__hd__.error.colors.title,
12750
+ lineHeight: theme.__hd__.error.lineHeight.title
12701
12751
  };
12702
12752
  });
12703
12753
  var StyledErrorDescription = index$a(Typography.Text)(function (_ref9) {
@@ -12706,7 +12756,8 @@ var StyledErrorDescription = index$a(Typography.Text)(function (_ref9) {
12706
12756
  fontFamily: theme.__hd__.error.fonts.description,
12707
12757
  fontSize: theme.__hd__.error.fontSizes.description,
12708
12758
  textAlign: 'center',
12709
- color: theme.__hd__.error.colors.description
12759
+ color: theme.__hd__.error.colors.description,
12760
+ lineHeight: theme.__hd__.error.lineHeight.description
12710
12761
  };
12711
12762
  });
12712
12763
 
@@ -13931,7 +13982,7 @@ var AnimatedSpinner = function AnimatedSpinner(_ref) {
13931
13982
  toValue: 1,
13932
13983
  duration: 1200,
13933
13984
  easing: reactNative.Easing.linear,
13934
- useNativeDriver: true
13985
+ useNativeDriver: reactNative.Platform.OS !== 'web'
13935
13986
  }));
13936
13987
  animation.start();
13937
13988
  return function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.24.0",
3
+ "version": "8.25.1",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@emotion/native": "^11.9.3",
23
23
  "@emotion/react": "^11.9.3",
24
- "@hero-design/colors": "8.24.0",
24
+ "@hero-design/colors": "8.25.1",
25
25
  "date-fns": "^2.16.1",
26
26
  "events": "^3.2.0",
27
27
  "hero-editor": "^1.9.21"
@@ -45,7 +45,7 @@
45
45
  "@babel/preset-typescript": "^7.17.12",
46
46
  "@babel/runtime": "^7.18.9",
47
47
  "@emotion/jest": "^11.9.3",
48
- "@hero-design/eslint-plugin": "8.24.0",
48
+ "@hero-design/eslint-plugin": "8.25.1",
49
49
  "@react-native-community/datetimepicker": "^3.5.2",
50
50
  "@react-native-community/slider": "4.1.12",
51
51
  "@rollup/plugin-babel": "^5.3.1",
@@ -61,9 +61,9 @@
61
61
  "@types/react-native": "^0.67.7",
62
62
  "@types/react-native-vector-icons": "^6.4.10",
63
63
  "babel-plugin-inline-import": "^3.0.0",
64
- "eslint-config-hd": "8.24.0",
64
+ "eslint-config-hd": "8.25.1",
65
65
  "jest": "^27.3.1",
66
- "prettier-config-hd": "8.24.0",
66
+ "prettier-config-hd": "8.25.1",
67
67
  "react": "18.0.0",
68
68
  "react-native": "0.69.7",
69
69
  "react-native-gesture-handler": "~2.1.0",
@@ -8,7 +8,9 @@ import React, {
8
8
  import {
9
9
  FlatList,
10
10
  LayoutChangeEvent,
11
+ Platform,
11
12
  StyleProp,
13
+ View,
12
14
  ViewStyle,
13
15
  } from 'react-native';
14
16
  import { useTheme } from '../../theme';
@@ -85,6 +87,8 @@ export const CardCarousel = forwardRef<CardCarouselHandles, CardCarouselProps>(
85
87
  const itemWidth = flatListWidth * ITEM_WIDTH_RATE;
86
88
  const carouselRef = useRef<FlatList>(null);
87
89
 
90
+ const viewPosition =
91
+ Platform.OS === 'ios' ? VIEW_POSITION_CENTER : undefined;
88
92
  const snapToIndex = useCallback(
89
93
  (index) => {
90
94
  let validIndex = 0;
@@ -99,7 +103,7 @@ export const CardCarousel = forwardRef<CardCarouselHandles, CardCarouselProps>(
99
103
  carouselRef.current?.scrollToIndex({
100
104
  index: validIndex,
101
105
  animated: true,
102
- viewPosition: VIEW_POSITION_CENTER,
106
+ viewPosition,
103
107
  });
104
108
  },
105
109
  [carouselRef, itemWidth]
@@ -116,7 +120,7 @@ export const CardCarousel = forwardRef<CardCarouselHandles, CardCarouselProps>(
116
120
  carouselRef.current?.scrollToIndex({
117
121
  index: nextIndex,
118
122
  animated: true,
119
- viewPosition: VIEW_POSITION_CENTER,
123
+ viewPosition,
120
124
  });
121
125
  }, [carouselRef, currentIndex, itemWidth, items.length]);
122
126
 
@@ -189,17 +193,27 @@ export const CardCarousel = forwardRef<CardCarouselHandles, CardCarouselProps>(
189
193
  [itemWidth]
190
194
  );
191
195
 
196
+ const { contentContainerPaddingHorizontal } =
197
+ theme.__hd__.cardCarousel.space;
192
198
  return (
193
199
  <StyledWrapper style={style} testID={testID}>
194
200
  <FlatList
195
201
  contentInset={{
196
202
  top: 0,
197
- left: theme.__hd__.cardCarousel.space
198
- .contentContainerPaddingHorizontal,
203
+ left: contentContainerPaddingHorizontal,
199
204
  bottom: 0,
200
- right:
201
- theme.__hd__.cardCarousel.space.contentContainerPaddingHorizontal,
205
+ right: contentContainerPaddingHorizontal,
202
206
  }}
207
+ ListHeaderComponent={Platform.select({
208
+ android: (
209
+ <View style={{ width: contentContainerPaddingHorizontal }} />
210
+ ),
211
+ })}
212
+ ListFooterComponent={Platform.select({
213
+ android: (
214
+ <View style={{ width: contentContainerPaddingHorizontal }} />
215
+ ),
216
+ })}
203
217
  onLayout={flatListOnLayout}
204
218
  data={items}
205
219
  horizontal
@@ -214,7 +228,9 @@ export const CardCarousel = forwardRef<CardCarouselHandles, CardCarouselProps>(
214
228
  keyExtractor={(_, index) => `${index}`}
215
229
  decelerationRate="fast"
216
230
  renderToHardwareTextureAndroid
217
- snapToInterval={itemWidth}
231
+ snapToInterval={Platform.select({
232
+ ios: itemWidth,
233
+ })}
218
234
  onViewableItemsChanged={visibleSlideChanged}
219
235
  viewabilityConfig={{
220
236
  itemVisiblePercentThreshold: 80,