@hero-design/rn 8.24.0 → 8.25.0
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/.turbo/turbo-build.log +9 -9
- package/es/index.js +66 -24
- package/lib/index.js +66 -24
- package/package.json +5 -5
- package/src/components/Carousel/CardCarousel.tsx +23 -7
- package/src/components/Carousel/__tests__/CardCarousel.spec.tsx +177 -70
- package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +294 -1
- package/src/components/Error/StyledError.tsx +2 -0
- package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +8 -0
- package/src/components/Spinner/AnimatedSpinner.tsx +2 -2
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +4 -0
- package/src/theme/components/error.ts +6 -1
- package/types/theme/components/error.d.ts +4 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
1
|
+
[33m@hero-design/rn:build[0m: cache hit, replaying output [2mb28cdc306082cd71[0m
|
|
2
|
+
[33m@hero-design/rn:build: [0m$ yarn build:js && yarn build:types
|
|
3
|
+
[33m@hero-design/rn:build: [0m$ rollup -c
|
|
4
|
+
[33m@hero-design/rn:build: [0m[36m
|
|
5
|
+
[33m@hero-design/rn:build: [0m[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
6
|
+
[33m@hero-design/rn:build: [0m[1m[33m(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
7
|
+
[33m@hero-design/rn:build: [0m[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning[39m[22m
|
|
8
|
+
[33m@hero-design/rn:build: [0m[32mcreated [1mlib/index.js, es/index.js[22m in [1m27.2s[22m[39m
|
|
9
|
+
[33m@hero-design/rn:build: [0m$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -981,9 +981,9 @@ var blue$1 = colorScales.blue,
|
|
|
981
981
|
purple$1 = colorScales.purple,
|
|
982
982
|
vermilion$3 = colorScales.vermilion,
|
|
983
983
|
smalt = colorScales.smalt,
|
|
984
|
-
violet$
|
|
984
|
+
violet$2 = colorScales.violet,
|
|
985
985
|
yellow$1 = colorScales.yellow;
|
|
986
|
-
|
|
986
|
+
var palette$b = {
|
|
987
987
|
black: '#000000',
|
|
988
988
|
white: '#ffffff',
|
|
989
989
|
blue: blue$1.base,
|
|
@@ -1058,21 +1058,38 @@ var blue$1 = colorScales.blue,
|
|
|
1058
1058
|
smaltLight45: smalt.lighten45,
|
|
1059
1059
|
smaltLight75: smalt.lighten75,
|
|
1060
1060
|
smaltLight90: smalt.lighten90,
|
|
1061
|
-
violet: violet$
|
|
1062
|
-
violetDark15: violet$
|
|
1063
|
-
violetDark30: violet$
|
|
1064
|
-
violetDark45: violet$
|
|
1065
|
-
violetDark60: violet$
|
|
1066
|
-
violetDark75: violet$
|
|
1067
|
-
violetLight30: violet$
|
|
1068
|
-
violetLight60: violet$
|
|
1069
|
-
violetLight75: violet$
|
|
1070
|
-
violetLight90: violet$
|
|
1061
|
+
violet: violet$2.base,
|
|
1062
|
+
violetDark15: violet$2.darken15,
|
|
1063
|
+
violetDark30: violet$2.darken30,
|
|
1064
|
+
violetDark45: violet$2.darken45,
|
|
1065
|
+
violetDark60: violet$2.darken60,
|
|
1066
|
+
violetDark75: violet$2.darken75,
|
|
1067
|
+
violetLight30: violet$2.lighten30,
|
|
1068
|
+
violetLight60: violet$2.lighten60,
|
|
1069
|
+
violetLight75: violet$2.lighten75,
|
|
1070
|
+
violetLight90: violet$2.lighten90,
|
|
1071
1071
|
yellow: yellow$1.base,
|
|
1072
1072
|
yellowDark15: yellow$1.darken15,
|
|
1073
1073
|
yellowDark75: yellow$1.darken75,
|
|
1074
1074
|
yellowLight60: yellow$1.lighten60,
|
|
1075
1075
|
yellowLight90: yellow$1.lighten90
|
|
1076
|
+
};
|
|
1077
|
+
var mauve$4 = colorScales.mauve,
|
|
1078
|
+
violet$1 = colorScales.violet;
|
|
1079
|
+
Object.assign(Object.assign({}, palette$b), {
|
|
1080
|
+
mauve: mauve$4.base,
|
|
1081
|
+
mauveLight80: mauve$4.lighten80,
|
|
1082
|
+
violetDark50: violet$1.darken50
|
|
1083
|
+
});
|
|
1084
|
+
var apple$4 = colorScales.apple,
|
|
1085
|
+
hitPink$1 = colorScales.hitPink;
|
|
1086
|
+
Object.assign(Object.assign({}, palette$b), {
|
|
1087
|
+
apple: apple$4.base,
|
|
1088
|
+
appleDark20: apple$4.darken20,
|
|
1089
|
+
appleDark50: apple$4.darken50,
|
|
1090
|
+
appleLight90: apple$4.lighten90,
|
|
1091
|
+
hitPink: hitPink$1.base,
|
|
1092
|
+
hitPinkLight80: hitPink$1.lighten80
|
|
1076
1093
|
});
|
|
1077
1094
|
var aliceBlue$1 = colorScales.aliceBlue,
|
|
1078
1095
|
antiFlashWhite$1 = colorScales.antiFlashWhite,
|
|
@@ -1239,7 +1256,7 @@ var currant$1 = colorScales.currant,
|
|
|
1239
1256
|
vermilion = colorScales.vermilion,
|
|
1240
1257
|
mauve$3 = colorScales.mauve,
|
|
1241
1258
|
violet1$3 = colorScales.violet1,
|
|
1242
|
-
violet$
|
|
1259
|
+
violet$3 = colorScales.violet,
|
|
1243
1260
|
scarletGum$2 = colorScales.scarletGum;
|
|
1244
1261
|
var palette$6 = {
|
|
1245
1262
|
currant: currant$1.base,
|
|
@@ -1258,9 +1275,9 @@ var palette$6 = {
|
|
|
1258
1275
|
pastelRed: pastelRed.base,
|
|
1259
1276
|
vermilion: vermilion.base,
|
|
1260
1277
|
mauve: mauve$3.base,
|
|
1261
|
-
violetLight30: violet$
|
|
1278
|
+
violetLight30: violet$3.lighten30,
|
|
1262
1279
|
violet1: violet1$3.base,
|
|
1263
|
-
violet: violet$
|
|
1280
|
+
violet: violet$3.base,
|
|
1264
1281
|
scarletGum: scarletGum$2.base
|
|
1265
1282
|
};
|
|
1266
1283
|
var violet1$2 = colorScales.violet1,
|
|
@@ -2240,12 +2257,17 @@ var getErrorTheme = function getErrorTheme(theme) {
|
|
|
2240
2257
|
title: theme.fonts.playful.semiBold,
|
|
2241
2258
|
description: theme.fonts.playful.regular
|
|
2242
2259
|
};
|
|
2260
|
+
var lineHeight = {
|
|
2261
|
+
title: theme.lineHeights.xxxlarge,
|
|
2262
|
+
description: theme.lineHeights.xlarge
|
|
2263
|
+
};
|
|
2243
2264
|
return {
|
|
2244
2265
|
fontSizes: fontSizes,
|
|
2245
2266
|
colors: colors,
|
|
2246
2267
|
sizes: sizes,
|
|
2247
2268
|
space: space,
|
|
2248
|
-
fonts: fonts
|
|
2269
|
+
fonts: fonts,
|
|
2270
|
+
lineHeight: lineHeight
|
|
2249
2271
|
};
|
|
2250
2272
|
};
|
|
2251
2273
|
|
|
@@ -11289,6 +11311,7 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
11289
11311
|
setFlatListWidth = _useState4[1];
|
|
11290
11312
|
var itemWidth = flatListWidth * ITEM_WIDTH_RATE;
|
|
11291
11313
|
var carouselRef = useRef(null);
|
|
11314
|
+
var viewPosition = Platform.OS === 'ios' ? VIEW_POSITION_CENTER : undefined;
|
|
11292
11315
|
var _snapToIndex = useCallback(function (index) {
|
|
11293
11316
|
var _carouselRef$current;
|
|
11294
11317
|
var validIndex = 0;
|
|
@@ -11302,7 +11325,7 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
11302
11325
|
(_carouselRef$current = carouselRef.current) === null || _carouselRef$current === void 0 ? void 0 : _carouselRef$current.scrollToIndex({
|
|
11303
11326
|
index: validIndex,
|
|
11304
11327
|
animated: true,
|
|
11305
|
-
viewPosition:
|
|
11328
|
+
viewPosition: viewPosition
|
|
11306
11329
|
});
|
|
11307
11330
|
}, [carouselRef, itemWidth]);
|
|
11308
11331
|
/*
|
|
@@ -11317,7 +11340,7 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
11317
11340
|
(_carouselRef$current2 = carouselRef.current) === null || _carouselRef$current2 === void 0 ? void 0 : _carouselRef$current2.scrollToIndex({
|
|
11318
11341
|
index: nextIndex,
|
|
11319
11342
|
animated: true,
|
|
11320
|
-
viewPosition:
|
|
11343
|
+
viewPosition: viewPosition
|
|
11321
11344
|
});
|
|
11322
11345
|
}, [carouselRef, currentIndex, itemWidth, items.length]);
|
|
11323
11346
|
React.useImperativeHandle(ref, function () {
|
|
@@ -11372,16 +11395,31 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
11372
11395
|
}
|
|
11373
11396
|
}, /*#__PURE__*/React.createElement(StyledShadow, null, /*#__PURE__*/React.createElement(StyledCard, null, item)));
|
|
11374
11397
|
}, [itemWidth]);
|
|
11398
|
+
var contentContainerPaddingHorizontal = theme.__hd__.cardCarousel.space.contentContainerPaddingHorizontal;
|
|
11375
11399
|
return /*#__PURE__*/React.createElement(StyledWrapper$7, {
|
|
11376
11400
|
style: style,
|
|
11377
11401
|
testID: testID
|
|
11378
11402
|
}, /*#__PURE__*/React.createElement(FlatList, {
|
|
11379
11403
|
contentInset: {
|
|
11380
11404
|
top: 0,
|
|
11381
|
-
left:
|
|
11405
|
+
left: contentContainerPaddingHorizontal,
|
|
11382
11406
|
bottom: 0,
|
|
11383
|
-
right:
|
|
11407
|
+
right: contentContainerPaddingHorizontal
|
|
11384
11408
|
},
|
|
11409
|
+
ListHeaderComponent: Platform.select({
|
|
11410
|
+
android: /*#__PURE__*/React.createElement(View, {
|
|
11411
|
+
style: {
|
|
11412
|
+
width: contentContainerPaddingHorizontal
|
|
11413
|
+
}
|
|
11414
|
+
})
|
|
11415
|
+
}),
|
|
11416
|
+
ListFooterComponent: Platform.select({
|
|
11417
|
+
android: /*#__PURE__*/React.createElement(View, {
|
|
11418
|
+
style: {
|
|
11419
|
+
width: contentContainerPaddingHorizontal
|
|
11420
|
+
}
|
|
11421
|
+
})
|
|
11422
|
+
}),
|
|
11385
11423
|
onLayout: flatListOnLayout,
|
|
11386
11424
|
data: items,
|
|
11387
11425
|
horizontal: true,
|
|
@@ -11398,7 +11436,9 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
11398
11436
|
},
|
|
11399
11437
|
decelerationRate: "fast",
|
|
11400
11438
|
renderToHardwareTextureAndroid: true,
|
|
11401
|
-
snapToInterval:
|
|
11439
|
+
snapToInterval: Platform.select({
|
|
11440
|
+
ios: itemWidth
|
|
11441
|
+
}),
|
|
11402
11442
|
onViewableItemsChanged: visibleSlideChanged,
|
|
11403
11443
|
viewabilityConfig: {
|
|
11404
11444
|
itemVisiblePercentThreshold: 80
|
|
@@ -12667,7 +12707,8 @@ var StyledErrorTitle = index$a(Typography.Text)(function (_ref8) {
|
|
|
12667
12707
|
fontSize: theme.__hd__.error.fontSizes.title,
|
|
12668
12708
|
textAlign: 'center',
|
|
12669
12709
|
marginBottom: theme.__hd__.error.space.titleMarginBottom,
|
|
12670
|
-
color: theme.__hd__.error.colors.title
|
|
12710
|
+
color: theme.__hd__.error.colors.title,
|
|
12711
|
+
lineHeight: theme.__hd__.error.lineHeight.title
|
|
12671
12712
|
};
|
|
12672
12713
|
});
|
|
12673
12714
|
var StyledErrorDescription = index$a(Typography.Text)(function (_ref9) {
|
|
@@ -12676,7 +12717,8 @@ var StyledErrorDescription = index$a(Typography.Text)(function (_ref9) {
|
|
|
12676
12717
|
fontFamily: theme.__hd__.error.fonts.description,
|
|
12677
12718
|
fontSize: theme.__hd__.error.fontSizes.description,
|
|
12678
12719
|
textAlign: 'center',
|
|
12679
|
-
color: theme.__hd__.error.colors.description
|
|
12720
|
+
color: theme.__hd__.error.colors.description,
|
|
12721
|
+
lineHeight: theme.__hd__.error.lineHeight.description
|
|
12680
12722
|
};
|
|
12681
12723
|
});
|
|
12682
12724
|
|
|
@@ -13901,7 +13943,7 @@ var AnimatedSpinner = function AnimatedSpinner(_ref) {
|
|
|
13901
13943
|
toValue: 1,
|
|
13902
13944
|
duration: 1200,
|
|
13903
13945
|
easing: Easing.linear,
|
|
13904
|
-
useNativeDriver:
|
|
13946
|
+
useNativeDriver: Platform.OS !== 'web'
|
|
13905
13947
|
}));
|
|
13906
13948
|
animation.start();
|
|
13907
13949
|
return function () {
|
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$
|
|
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,38 @@ var blue$1 = colorScales.blue,
|
|
|
1088
1088
|
smaltLight45: smalt.lighten45,
|
|
1089
1089
|
smaltLight75: smalt.lighten75,
|
|
1090
1090
|
smaltLight90: smalt.lighten90,
|
|
1091
|
-
violet: violet$
|
|
1092
|
-
violetDark15: violet$
|
|
1093
|
-
violetDark30: violet$
|
|
1094
|
-
violetDark45: violet$
|
|
1095
|
-
violetDark60: violet$
|
|
1096
|
-
violetDark75: violet$
|
|
1097
|
-
violetLight30: violet$
|
|
1098
|
-
violetLight60: violet$
|
|
1099
|
-
violetLight75: violet$
|
|
1100
|
-
violetLight90: violet$
|
|
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
1104
|
yellowLight60: yellow$1.lighten60,
|
|
1105
1105
|
yellowLight90: yellow$1.lighten90
|
|
1106
|
+
};
|
|
1107
|
+
var mauve$4 = colorScales.mauve,
|
|
1108
|
+
violet$1 = colorScales.violet;
|
|
1109
|
+
Object.assign(Object.assign({}, palette$b), {
|
|
1110
|
+
mauve: mauve$4.base,
|
|
1111
|
+
mauveLight80: mauve$4.lighten80,
|
|
1112
|
+
violetDark50: violet$1.darken50
|
|
1113
|
+
});
|
|
1114
|
+
var apple$4 = colorScales.apple,
|
|
1115
|
+
hitPink$1 = colorScales.hitPink;
|
|
1116
|
+
Object.assign(Object.assign({}, palette$b), {
|
|
1117
|
+
apple: apple$4.base,
|
|
1118
|
+
appleDark20: apple$4.darken20,
|
|
1119
|
+
appleDark50: apple$4.darken50,
|
|
1120
|
+
appleLight90: apple$4.lighten90,
|
|
1121
|
+
hitPink: hitPink$1.base,
|
|
1122
|
+
hitPinkLight80: hitPink$1.lighten80
|
|
1106
1123
|
});
|
|
1107
1124
|
var aliceBlue$1 = colorScales.aliceBlue,
|
|
1108
1125
|
antiFlashWhite$1 = colorScales.antiFlashWhite,
|
|
@@ -1269,7 +1286,7 @@ var currant$1 = colorScales.currant,
|
|
|
1269
1286
|
vermilion = colorScales.vermilion,
|
|
1270
1287
|
mauve$3 = colorScales.mauve,
|
|
1271
1288
|
violet1$3 = colorScales.violet1,
|
|
1272
|
-
violet$
|
|
1289
|
+
violet$3 = colorScales.violet,
|
|
1273
1290
|
scarletGum$2 = colorScales.scarletGum;
|
|
1274
1291
|
var palette$6 = {
|
|
1275
1292
|
currant: currant$1.base,
|
|
@@ -1288,9 +1305,9 @@ var palette$6 = {
|
|
|
1288
1305
|
pastelRed: pastelRed.base,
|
|
1289
1306
|
vermilion: vermilion.base,
|
|
1290
1307
|
mauve: mauve$3.base,
|
|
1291
|
-
violetLight30: violet$
|
|
1308
|
+
violetLight30: violet$3.lighten30,
|
|
1292
1309
|
violet1: violet1$3.base,
|
|
1293
|
-
violet: violet$
|
|
1310
|
+
violet: violet$3.base,
|
|
1294
1311
|
scarletGum: scarletGum$2.base
|
|
1295
1312
|
};
|
|
1296
1313
|
var violet1$2 = colorScales.violet1,
|
|
@@ -2270,12 +2287,17 @@ var getErrorTheme = function getErrorTheme(theme) {
|
|
|
2270
2287
|
title: theme.fonts.playful.semiBold,
|
|
2271
2288
|
description: theme.fonts.playful.regular
|
|
2272
2289
|
};
|
|
2290
|
+
var lineHeight = {
|
|
2291
|
+
title: theme.lineHeights.xxxlarge,
|
|
2292
|
+
description: theme.lineHeights.xlarge
|
|
2293
|
+
};
|
|
2273
2294
|
return {
|
|
2274
2295
|
fontSizes: fontSizes,
|
|
2275
2296
|
colors: colors,
|
|
2276
2297
|
sizes: sizes,
|
|
2277
2298
|
space: space,
|
|
2278
|
-
fonts: fonts
|
|
2299
|
+
fonts: fonts,
|
|
2300
|
+
lineHeight: lineHeight
|
|
2279
2301
|
};
|
|
2280
2302
|
};
|
|
2281
2303
|
|
|
@@ -11319,6 +11341,7 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11319
11341
|
setFlatListWidth = _useState4[1];
|
|
11320
11342
|
var itemWidth = flatListWidth * ITEM_WIDTH_RATE;
|
|
11321
11343
|
var carouselRef = React.useRef(null);
|
|
11344
|
+
var viewPosition = reactNative.Platform.OS === 'ios' ? VIEW_POSITION_CENTER : undefined;
|
|
11322
11345
|
var _snapToIndex = React.useCallback(function (index) {
|
|
11323
11346
|
var _carouselRef$current;
|
|
11324
11347
|
var validIndex = 0;
|
|
@@ -11332,7 +11355,7 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11332
11355
|
(_carouselRef$current = carouselRef.current) === null || _carouselRef$current === void 0 ? void 0 : _carouselRef$current.scrollToIndex({
|
|
11333
11356
|
index: validIndex,
|
|
11334
11357
|
animated: true,
|
|
11335
|
-
viewPosition:
|
|
11358
|
+
viewPosition: viewPosition
|
|
11336
11359
|
});
|
|
11337
11360
|
}, [carouselRef, itemWidth]);
|
|
11338
11361
|
/*
|
|
@@ -11347,7 +11370,7 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11347
11370
|
(_carouselRef$current2 = carouselRef.current) === null || _carouselRef$current2 === void 0 ? void 0 : _carouselRef$current2.scrollToIndex({
|
|
11348
11371
|
index: nextIndex,
|
|
11349
11372
|
animated: true,
|
|
11350
|
-
viewPosition:
|
|
11373
|
+
viewPosition: viewPosition
|
|
11351
11374
|
});
|
|
11352
11375
|
}, [carouselRef, currentIndex, itemWidth, items.length]);
|
|
11353
11376
|
React__default["default"].useImperativeHandle(ref, function () {
|
|
@@ -11402,16 +11425,31 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11402
11425
|
}
|
|
11403
11426
|
}, /*#__PURE__*/React__default["default"].createElement(StyledShadow, null, /*#__PURE__*/React__default["default"].createElement(StyledCard, null, item)));
|
|
11404
11427
|
}, [itemWidth]);
|
|
11428
|
+
var contentContainerPaddingHorizontal = theme.__hd__.cardCarousel.space.contentContainerPaddingHorizontal;
|
|
11405
11429
|
return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$7, {
|
|
11406
11430
|
style: style,
|
|
11407
11431
|
testID: testID
|
|
11408
11432
|
}, /*#__PURE__*/React__default["default"].createElement(reactNative.FlatList, {
|
|
11409
11433
|
contentInset: {
|
|
11410
11434
|
top: 0,
|
|
11411
|
-
left:
|
|
11435
|
+
left: contentContainerPaddingHorizontal,
|
|
11412
11436
|
bottom: 0,
|
|
11413
|
-
right:
|
|
11437
|
+
right: contentContainerPaddingHorizontal
|
|
11414
11438
|
},
|
|
11439
|
+
ListHeaderComponent: reactNative.Platform.select({
|
|
11440
|
+
android: /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
|
|
11441
|
+
style: {
|
|
11442
|
+
width: contentContainerPaddingHorizontal
|
|
11443
|
+
}
|
|
11444
|
+
})
|
|
11445
|
+
}),
|
|
11446
|
+
ListFooterComponent: reactNative.Platform.select({
|
|
11447
|
+
android: /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
|
|
11448
|
+
style: {
|
|
11449
|
+
width: contentContainerPaddingHorizontal
|
|
11450
|
+
}
|
|
11451
|
+
})
|
|
11452
|
+
}),
|
|
11415
11453
|
onLayout: flatListOnLayout,
|
|
11416
11454
|
data: items,
|
|
11417
11455
|
horizontal: true,
|
|
@@ -11428,7 +11466,9 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11428
11466
|
},
|
|
11429
11467
|
decelerationRate: "fast",
|
|
11430
11468
|
renderToHardwareTextureAndroid: true,
|
|
11431
|
-
snapToInterval:
|
|
11469
|
+
snapToInterval: reactNative.Platform.select({
|
|
11470
|
+
ios: itemWidth
|
|
11471
|
+
}),
|
|
11432
11472
|
onViewableItemsChanged: visibleSlideChanged,
|
|
11433
11473
|
viewabilityConfig: {
|
|
11434
11474
|
itemVisiblePercentThreshold: 80
|
|
@@ -12697,7 +12737,8 @@ var StyledErrorTitle = index$a(Typography.Text)(function (_ref8) {
|
|
|
12697
12737
|
fontSize: theme.__hd__.error.fontSizes.title,
|
|
12698
12738
|
textAlign: 'center',
|
|
12699
12739
|
marginBottom: theme.__hd__.error.space.titleMarginBottom,
|
|
12700
|
-
color: theme.__hd__.error.colors.title
|
|
12740
|
+
color: theme.__hd__.error.colors.title,
|
|
12741
|
+
lineHeight: theme.__hd__.error.lineHeight.title
|
|
12701
12742
|
};
|
|
12702
12743
|
});
|
|
12703
12744
|
var StyledErrorDescription = index$a(Typography.Text)(function (_ref9) {
|
|
@@ -12706,7 +12747,8 @@ var StyledErrorDescription = index$a(Typography.Text)(function (_ref9) {
|
|
|
12706
12747
|
fontFamily: theme.__hd__.error.fonts.description,
|
|
12707
12748
|
fontSize: theme.__hd__.error.fontSizes.description,
|
|
12708
12749
|
textAlign: 'center',
|
|
12709
|
-
color: theme.__hd__.error.colors.description
|
|
12750
|
+
color: theme.__hd__.error.colors.description,
|
|
12751
|
+
lineHeight: theme.__hd__.error.lineHeight.description
|
|
12710
12752
|
};
|
|
12711
12753
|
});
|
|
12712
12754
|
|
|
@@ -13931,7 +13973,7 @@ var AnimatedSpinner = function AnimatedSpinner(_ref) {
|
|
|
13931
13973
|
toValue: 1,
|
|
13932
13974
|
duration: 1200,
|
|
13933
13975
|
easing: reactNative.Easing.linear,
|
|
13934
|
-
useNativeDriver:
|
|
13976
|
+
useNativeDriver: reactNative.Platform.OS !== 'web'
|
|
13935
13977
|
}));
|
|
13936
13978
|
animation.start();
|
|
13937
13979
|
return function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.25.0",
|
|
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
|
+
"@hero-design/colors": "8.25.0",
|
|
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.
|
|
48
|
+
"@hero-design/eslint-plugin": "8.25.0",
|
|
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.
|
|
64
|
+
"eslint-config-hd": "8.25.0",
|
|
65
65
|
"jest": "^27.3.1",
|
|
66
|
-
"prettier-config-hd": "8.
|
|
66
|
+
"prettier-config-hd": "8.25.0",
|
|
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
|
|
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
|
|
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:
|
|
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={
|
|
231
|
+
snapToInterval={Platform.select({
|
|
232
|
+
ios: itemWidth,
|
|
233
|
+
})}
|
|
218
234
|
onViewableItemsChanged={visibleSlideChanged}
|
|
219
235
|
viewabilityConfig={{
|
|
220
236
|
itemVisiblePercentThreshold: 80,
|
|
@@ -1,104 +1,211 @@
|
|
|
1
1
|
import { waitFor } from '@testing-library/react-native';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { FlatList } from 'react-native';
|
|
3
|
+
import { FlatList, Platform } from 'react-native';
|
|
4
4
|
import { CardCarousel, CardCarouselHandles } from '../CardCarousel';
|
|
5
5
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
6
6
|
import Typography from '../../Typography';
|
|
7
7
|
|
|
8
8
|
describe('CardCarousel', () => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
style={{ width: 100, height: 100 }}
|
|
14
|
-
items={[
|
|
15
|
-
<Typography.Text> screen 1</Typography.Text>,
|
|
16
|
-
<Typography.Text> screen 2</Typography.Text>,
|
|
17
|
-
]}
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
22
|
-
expect(wrapper.queryAllByText('screen 1')).toHaveLength(1);
|
|
23
|
-
expect(wrapper.queryAllByText('screen 2')).toHaveLength(1);
|
|
24
|
-
expect(wrapper.queryAllByTestId('pageControl')).toHaveLength(1);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
describe('autoPlay', () => {
|
|
28
|
-
it('should call scrollToIndex 1', () => {
|
|
29
|
-
jest.useFakeTimers();
|
|
30
|
-
const carouselRef = React.createRef<
|
|
31
|
-
CardCarouselHandles & {
|
|
32
|
-
getFlatListRef: () => FlatList;
|
|
33
|
-
}
|
|
34
|
-
>();
|
|
9
|
+
describe('ios', () => {
|
|
10
|
+
beforeAll(() => {
|
|
11
|
+
Platform.OS = 'ios';
|
|
12
|
+
});
|
|
35
13
|
|
|
36
|
-
|
|
14
|
+
it('should render correctly on iOS', () => {
|
|
15
|
+
const wrapper = renderWithTheme(
|
|
37
16
|
<CardCarousel
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
autoPlayInterval={3000}
|
|
17
|
+
testID="cardCarousel"
|
|
18
|
+
style={{ width: 100, height: 100 }}
|
|
41
19
|
items={[
|
|
42
20
|
<Typography.Text> screen 1</Typography.Text>,
|
|
43
21
|
<Typography.Text> screen 2</Typography.Text>,
|
|
44
22
|
]}
|
|
45
23
|
/>
|
|
46
24
|
);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
expect(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
25
|
+
|
|
26
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
27
|
+
expect(wrapper.queryAllByText('screen 1')).toHaveLength(1);
|
|
28
|
+
expect(wrapper.queryAllByText('screen 2')).toHaveLength(1);
|
|
29
|
+
expect(wrapper.queryAllByTestId('pageControl')).toHaveLength(1);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('autoPlay', () => {
|
|
33
|
+
it('should call scrollToIndex 1', () => {
|
|
34
|
+
jest.useFakeTimers();
|
|
35
|
+
const carouselRef = React.createRef<
|
|
36
|
+
CardCarouselHandles & {
|
|
37
|
+
getFlatListRef: () => FlatList;
|
|
38
|
+
}
|
|
39
|
+
>();
|
|
40
|
+
|
|
41
|
+
renderWithTheme(
|
|
42
|
+
<CardCarousel
|
|
43
|
+
ref={carouselRef}
|
|
44
|
+
autoPlay
|
|
45
|
+
autoPlayInterval={3000}
|
|
46
|
+
items={[
|
|
47
|
+
<Typography.Text> screen 1</Typography.Text>,
|
|
48
|
+
<Typography.Text> screen 2</Typography.Text>,
|
|
49
|
+
]}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
const flatListRef = carouselRef.current!.getFlatListRef()!;
|
|
53
|
+
const snapToIndexSpy = jest.spyOn(flatListRef, 'scrollToIndex');
|
|
54
|
+
jest.advanceTimersByTime(3000);
|
|
55
|
+
expect(snapToIndexSpy).toHaveBeenCalledWith({
|
|
56
|
+
animated: true,
|
|
57
|
+
index: 1,
|
|
58
|
+
viewPosition: 0.5,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
jest.useRealTimers();
|
|
54
62
|
});
|
|
63
|
+
});
|
|
55
64
|
|
|
56
|
-
|
|
65
|
+
describe('hidePageControl', () => {
|
|
66
|
+
const wrapper = renderWithTheme(
|
|
67
|
+
<CardCarousel
|
|
68
|
+
style={{ width: 100, height: 100 }}
|
|
69
|
+
hidePageControl
|
|
70
|
+
items={[
|
|
71
|
+
<Typography.Text> screen 1</Typography.Text>,
|
|
72
|
+
<Typography.Text> screen 2</Typography.Text>,
|
|
73
|
+
]}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
expect(wrapper.queryAllByTestId('pageControl')).toHaveLength(0);
|
|
57
77
|
});
|
|
58
|
-
});
|
|
59
78
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
describe('snapToIndex', () => {
|
|
80
|
+
it('should render correctly', () => {
|
|
81
|
+
const carouselRef = React.createRef<
|
|
82
|
+
CardCarouselHandles & {
|
|
83
|
+
getFlatListRef: () => FlatList;
|
|
84
|
+
}
|
|
85
|
+
>();
|
|
86
|
+
|
|
87
|
+
renderWithTheme(
|
|
88
|
+
<CardCarousel
|
|
89
|
+
ref={carouselRef}
|
|
90
|
+
items={[
|
|
91
|
+
<Typography.Text> screen 1</Typography.Text>,
|
|
92
|
+
<Typography.Text> screen 2</Typography.Text>,
|
|
93
|
+
<Typography.Text> screen 3</Typography.Text>,
|
|
94
|
+
]}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const flatListRef = carouselRef.current!.getFlatListRef()!;
|
|
99
|
+
const snapToIndexSpy = jest.spyOn(flatListRef, 'scrollToIndex');
|
|
100
|
+
carouselRef.current?.snapToIndex(2);
|
|
101
|
+
waitFor(() => expect(snapToIndexSpy).toHaveBeenCalled());
|
|
102
|
+
|
|
103
|
+
expect(snapToIndexSpy).toHaveBeenCalledWith({
|
|
104
|
+
animated: true,
|
|
105
|
+
index: 2,
|
|
106
|
+
viewPosition: 0.5,
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
72
110
|
});
|
|
111
|
+
describe('android', () => {
|
|
112
|
+
beforeAll(() => {
|
|
113
|
+
Platform.OS = 'android';
|
|
114
|
+
});
|
|
115
|
+
it('should render correctly on iOS', () => {
|
|
116
|
+
const wrapper = renderWithTheme(
|
|
117
|
+
<CardCarousel
|
|
118
|
+
testID="cardCarousel"
|
|
119
|
+
style={{ width: 100, height: 100 }}
|
|
120
|
+
items={[
|
|
121
|
+
<Typography.Text> screen 1</Typography.Text>,
|
|
122
|
+
<Typography.Text> screen 2</Typography.Text>,
|
|
123
|
+
]}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
73
126
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
127
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
128
|
+
expect(wrapper.queryAllByText('screen 1')).toHaveLength(1);
|
|
129
|
+
expect(wrapper.queryAllByText('screen 2')).toHaveLength(1);
|
|
130
|
+
expect(wrapper.queryAllByTestId('pageControl')).toHaveLength(1);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('autoPlay', () => {
|
|
134
|
+
it('should call scrollToIndex 1', () => {
|
|
135
|
+
jest.useFakeTimers();
|
|
136
|
+
const carouselRef = React.createRef<
|
|
137
|
+
CardCarouselHandles & {
|
|
138
|
+
getFlatListRef: () => FlatList;
|
|
139
|
+
}
|
|
140
|
+
>();
|
|
141
|
+
|
|
142
|
+
renderWithTheme(
|
|
143
|
+
<CardCarousel
|
|
144
|
+
ref={carouselRef}
|
|
145
|
+
autoPlay
|
|
146
|
+
autoPlayInterval={3000}
|
|
147
|
+
items={[
|
|
148
|
+
<Typography.Text> screen 1</Typography.Text>,
|
|
149
|
+
<Typography.Text> screen 2</Typography.Text>,
|
|
150
|
+
]}
|
|
151
|
+
/>
|
|
152
|
+
);
|
|
153
|
+
const flatListRef = carouselRef.current!.getFlatListRef()!;
|
|
154
|
+
const snapToIndexSpy = jest.spyOn(flatListRef, 'scrollToIndex');
|
|
155
|
+
jest.advanceTimersByTime(3000);
|
|
156
|
+
expect(snapToIndexSpy).toHaveBeenCalledWith({
|
|
157
|
+
animated: true,
|
|
158
|
+
index: 1,
|
|
159
|
+
viewPosition: undefined,
|
|
160
|
+
});
|
|
81
161
|
|
|
82
|
-
|
|
162
|
+
jest.useRealTimers();
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
describe('hidePageControl', () => {
|
|
167
|
+
const wrapper = renderWithTheme(
|
|
83
168
|
<CardCarousel
|
|
84
|
-
|
|
169
|
+
style={{ width: 100, height: 100 }}
|
|
170
|
+
hidePageControl
|
|
85
171
|
items={[
|
|
86
172
|
<Typography.Text> screen 1</Typography.Text>,
|
|
87
173
|
<Typography.Text> screen 2</Typography.Text>,
|
|
88
|
-
<Typography.Text> screen 3</Typography.Text>,
|
|
89
174
|
]}
|
|
90
175
|
/>
|
|
91
176
|
);
|
|
177
|
+
expect(wrapper.queryAllByTestId('pageControl')).toHaveLength(0);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
describe('snapToIndex', () => {
|
|
181
|
+
it('should render correctly', () => {
|
|
182
|
+
const carouselRef = React.createRef<
|
|
183
|
+
CardCarouselHandles & {
|
|
184
|
+
getFlatListRef: () => FlatList;
|
|
185
|
+
}
|
|
186
|
+
>();
|
|
187
|
+
|
|
188
|
+
renderWithTheme(
|
|
189
|
+
<CardCarousel
|
|
190
|
+
ref={carouselRef}
|
|
191
|
+
items={[
|
|
192
|
+
<Typography.Text> screen 1</Typography.Text>,
|
|
193
|
+
<Typography.Text> screen 2</Typography.Text>,
|
|
194
|
+
<Typography.Text> screen 3</Typography.Text>,
|
|
195
|
+
]}
|
|
196
|
+
/>
|
|
197
|
+
);
|
|
92
198
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
199
|
+
const flatListRef = carouselRef.current!.getFlatListRef()!;
|
|
200
|
+
const snapToIndexSpy = jest.spyOn(flatListRef, 'scrollToIndex');
|
|
201
|
+
carouselRef.current?.snapToIndex(2);
|
|
202
|
+
waitFor(() => expect(snapToIndexSpy).toHaveBeenCalled());
|
|
97
203
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
204
|
+
expect(snapToIndexSpy).toHaveBeenCalledWith({
|
|
205
|
+
animated: true,
|
|
206
|
+
index: 2,
|
|
207
|
+
viewPosition: undefined,
|
|
208
|
+
});
|
|
102
209
|
});
|
|
103
210
|
});
|
|
104
211
|
});
|
|
@@ -1,6 +1,299 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`CardCarousel should render correctly 1`] = `
|
|
3
|
+
exports[`CardCarousel android should render correctly on iOS 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
Array [
|
|
7
|
+
Object {},
|
|
8
|
+
Object {
|
|
9
|
+
"height": 100,
|
|
10
|
+
"width": 100,
|
|
11
|
+
},
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
testID="cardCarousel"
|
|
15
|
+
>
|
|
16
|
+
<RCTScrollView
|
|
17
|
+
bounces={false}
|
|
18
|
+
contentInset={
|
|
19
|
+
Object {
|
|
20
|
+
"bottom": 0,
|
|
21
|
+
"left": 24,
|
|
22
|
+
"right": 24,
|
|
23
|
+
"top": 0,
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
data={
|
|
27
|
+
Array [
|
|
28
|
+
<Text>
|
|
29
|
+
screen 1
|
|
30
|
+
</Text>,
|
|
31
|
+
<Text>
|
|
32
|
+
screen 2
|
|
33
|
+
</Text>,
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
decelerationRate="fast"
|
|
37
|
+
getItem={[Function]}
|
|
38
|
+
getItemCount={[Function]}
|
|
39
|
+
getItemLayout={[Function]}
|
|
40
|
+
horizontal={true}
|
|
41
|
+
keyExtractor={[Function]}
|
|
42
|
+
onContentSizeChange={[Function]}
|
|
43
|
+
onLayout={[Function]}
|
|
44
|
+
onMomentumScrollBegin={[Function]}
|
|
45
|
+
onMomentumScrollEnd={[Function]}
|
|
46
|
+
onScroll={[Function]}
|
|
47
|
+
onScrollBeginDrag={[Function]}
|
|
48
|
+
onScrollEndDrag={[Function]}
|
|
49
|
+
onViewableItemsChanged={[Function]}
|
|
50
|
+
pagingEnabled={true}
|
|
51
|
+
removeClippedSubviews={true}
|
|
52
|
+
renderItem={[Function]}
|
|
53
|
+
renderToHardwareTextureAndroid={true}
|
|
54
|
+
scrollEventThrottle={32}
|
|
55
|
+
showsHorizontalScrollIndicator={false}
|
|
56
|
+
snapToAlignment="center"
|
|
57
|
+
snapToInterval={0}
|
|
58
|
+
stickyHeaderIndices={Array []}
|
|
59
|
+
viewabilityConfig={
|
|
60
|
+
Object {
|
|
61
|
+
"itemVisiblePercentThreshold": 80,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
viewabilityConfigCallbackPairs={
|
|
65
|
+
Array [
|
|
66
|
+
Object {
|
|
67
|
+
"onViewableItemsChanged": [Function],
|
|
68
|
+
"viewabilityConfig": Object {
|
|
69
|
+
"itemVisiblePercentThreshold": 80,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
>
|
|
75
|
+
<View>
|
|
76
|
+
<View
|
|
77
|
+
style={
|
|
78
|
+
Array [
|
|
79
|
+
Object {
|
|
80
|
+
"flexDirection": "row",
|
|
81
|
+
},
|
|
82
|
+
null,
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
>
|
|
86
|
+
<View
|
|
87
|
+
style={
|
|
88
|
+
Array [
|
|
89
|
+
Object {
|
|
90
|
+
"padding": 8,
|
|
91
|
+
},
|
|
92
|
+
Object {
|
|
93
|
+
"width": 0,
|
|
94
|
+
},
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
>
|
|
98
|
+
<View
|
|
99
|
+
style={
|
|
100
|
+
Array [
|
|
101
|
+
Object {
|
|
102
|
+
"borderRadius": 8,
|
|
103
|
+
"elevation": 4,
|
|
104
|
+
"flex": 1,
|
|
105
|
+
"shadowColor": "#001f23",
|
|
106
|
+
"shadowOffset": Object {
|
|
107
|
+
"height": 2,
|
|
108
|
+
"width": 0,
|
|
109
|
+
},
|
|
110
|
+
"shadowOpacity": 0.12,
|
|
111
|
+
"shadowRadius": 8,
|
|
112
|
+
},
|
|
113
|
+
undefined,
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
>
|
|
117
|
+
<View
|
|
118
|
+
style={
|
|
119
|
+
Array [
|
|
120
|
+
Object {
|
|
121
|
+
"borderRadius": 12,
|
|
122
|
+
"overflow": "hidden",
|
|
123
|
+
},
|
|
124
|
+
Array [
|
|
125
|
+
Object {
|
|
126
|
+
"borderRadius": 8,
|
|
127
|
+
"flex": 1,
|
|
128
|
+
"overflow": "hidden",
|
|
129
|
+
},
|
|
130
|
+
undefined,
|
|
131
|
+
],
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
>
|
|
135
|
+
<Text
|
|
136
|
+
allowFontScaling={false}
|
|
137
|
+
style={
|
|
138
|
+
Array [
|
|
139
|
+
Object {
|
|
140
|
+
"color": "#001f23",
|
|
141
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
142
|
+
"fontSize": 14,
|
|
143
|
+
"letterSpacing": 0.42,
|
|
144
|
+
"lineHeight": 22,
|
|
145
|
+
},
|
|
146
|
+
undefined,
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
themeFontSize="medium"
|
|
150
|
+
themeFontWeight="regular"
|
|
151
|
+
themeIntent="body"
|
|
152
|
+
themeTypeface="neutral"
|
|
153
|
+
>
|
|
154
|
+
screen 1
|
|
155
|
+
</Text>
|
|
156
|
+
</View>
|
|
157
|
+
</View>
|
|
158
|
+
</View>
|
|
159
|
+
</View>
|
|
160
|
+
<View
|
|
161
|
+
style={
|
|
162
|
+
Array [
|
|
163
|
+
Object {
|
|
164
|
+
"flexDirection": "row",
|
|
165
|
+
},
|
|
166
|
+
null,
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
>
|
|
170
|
+
<View
|
|
171
|
+
style={
|
|
172
|
+
Array [
|
|
173
|
+
Object {
|
|
174
|
+
"padding": 8,
|
|
175
|
+
},
|
|
176
|
+
Object {
|
|
177
|
+
"width": 0,
|
|
178
|
+
},
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
>
|
|
182
|
+
<View
|
|
183
|
+
style={
|
|
184
|
+
Array [
|
|
185
|
+
Object {
|
|
186
|
+
"borderRadius": 8,
|
|
187
|
+
"elevation": 4,
|
|
188
|
+
"flex": 1,
|
|
189
|
+
"shadowColor": "#001f23",
|
|
190
|
+
"shadowOffset": Object {
|
|
191
|
+
"height": 2,
|
|
192
|
+
"width": 0,
|
|
193
|
+
},
|
|
194
|
+
"shadowOpacity": 0.12,
|
|
195
|
+
"shadowRadius": 8,
|
|
196
|
+
},
|
|
197
|
+
undefined,
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
>
|
|
201
|
+
<View
|
|
202
|
+
style={
|
|
203
|
+
Array [
|
|
204
|
+
Object {
|
|
205
|
+
"borderRadius": 12,
|
|
206
|
+
"overflow": "hidden",
|
|
207
|
+
},
|
|
208
|
+
Array [
|
|
209
|
+
Object {
|
|
210
|
+
"borderRadius": 8,
|
|
211
|
+
"flex": 1,
|
|
212
|
+
"overflow": "hidden",
|
|
213
|
+
},
|
|
214
|
+
undefined,
|
|
215
|
+
],
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
>
|
|
219
|
+
<Text
|
|
220
|
+
allowFontScaling={false}
|
|
221
|
+
style={
|
|
222
|
+
Array [
|
|
223
|
+
Object {
|
|
224
|
+
"color": "#001f23",
|
|
225
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
226
|
+
"fontSize": 14,
|
|
227
|
+
"letterSpacing": 0.42,
|
|
228
|
+
"lineHeight": 22,
|
|
229
|
+
},
|
|
230
|
+
undefined,
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
themeFontSize="medium"
|
|
234
|
+
themeFontWeight="regular"
|
|
235
|
+
themeIntent="body"
|
|
236
|
+
themeTypeface="neutral"
|
|
237
|
+
>
|
|
238
|
+
screen 2
|
|
239
|
+
</Text>
|
|
240
|
+
</View>
|
|
241
|
+
</View>
|
|
242
|
+
</View>
|
|
243
|
+
</View>
|
|
244
|
+
</View>
|
|
245
|
+
</RCTScrollView>
|
|
246
|
+
<View
|
|
247
|
+
style={
|
|
248
|
+
Array [
|
|
249
|
+
Object {
|
|
250
|
+
"alignItems": "center",
|
|
251
|
+
"flexDirection": "row",
|
|
252
|
+
},
|
|
253
|
+
Array [
|
|
254
|
+
Object {
|
|
255
|
+
"alignSelf": "center",
|
|
256
|
+
"marginTop": 16,
|
|
257
|
+
},
|
|
258
|
+
undefined,
|
|
259
|
+
],
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
testID="pageControl"
|
|
263
|
+
>
|
|
264
|
+
<View
|
|
265
|
+
collapsable={false}
|
|
266
|
+
style={
|
|
267
|
+
Object {
|
|
268
|
+
"backgroundColor": "#401960",
|
|
269
|
+
"borderRadius": 999,
|
|
270
|
+
"height": 8,
|
|
271
|
+
"marginHorizontal": 8,
|
|
272
|
+
"opacity": 1,
|
|
273
|
+
"width": 24,
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
testID="page-control-indicator0"
|
|
277
|
+
/>
|
|
278
|
+
<View
|
|
279
|
+
collapsable={false}
|
|
280
|
+
style={
|
|
281
|
+
Object {
|
|
282
|
+
"backgroundColor": "#401960",
|
|
283
|
+
"borderRadius": 999,
|
|
284
|
+
"height": 8,
|
|
285
|
+
"marginHorizontal": 8,
|
|
286
|
+
"opacity": 0.5,
|
|
287
|
+
"width": 8,
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
testID="page-control-indicator1"
|
|
291
|
+
/>
|
|
292
|
+
</View>
|
|
293
|
+
</View>
|
|
294
|
+
`;
|
|
295
|
+
|
|
296
|
+
exports[`CardCarousel ios should render correctly on iOS 1`] = `
|
|
4
297
|
<View
|
|
5
298
|
style={
|
|
6
299
|
Array [
|
|
@@ -68,6 +68,7 @@ const StyledErrorTitle = styled(Typography.Text)(({ theme }) => ({
|
|
|
68
68
|
textAlign: 'center',
|
|
69
69
|
marginBottom: theme.__hd__.error.space.titleMarginBottom,
|
|
70
70
|
color: theme.__hd__.error.colors.title,
|
|
71
|
+
lineHeight: theme.__hd__.error.lineHeight.title,
|
|
71
72
|
}));
|
|
72
73
|
|
|
73
74
|
const StyledErrorDescription = styled(Typography.Text)(({ theme }) => ({
|
|
@@ -75,6 +76,7 @@ const StyledErrorDescription = styled(Typography.Text)(({ theme }) => ({
|
|
|
75
76
|
fontSize: theme.__hd__.error.fontSizes.description,
|
|
76
77
|
textAlign: 'center',
|
|
77
78
|
color: theme.__hd__.error.colors.description,
|
|
79
|
+
lineHeight: theme.__hd__.error.lineHeight.description,
|
|
78
80
|
}));
|
|
79
81
|
|
|
80
82
|
export {
|
|
@@ -77,6 +77,7 @@ exports[`Error renders error screen with custom image element correctly 1`] = `
|
|
|
77
77
|
"color": "#001f23",
|
|
78
78
|
"fontFamily": "RebondGrotesque-SemiBold",
|
|
79
79
|
"fontSize": 24,
|
|
80
|
+
"lineHeight": 32,
|
|
80
81
|
"marginBottom": 8,
|
|
81
82
|
"textAlign": "center",
|
|
82
83
|
},
|
|
@@ -107,6 +108,7 @@ exports[`Error renders error screen with custom image element correctly 1`] = `
|
|
|
107
108
|
"color": "#4d6265",
|
|
108
109
|
"fontFamily": "RebondGrotesque",
|
|
109
110
|
"fontSize": 18,
|
|
111
|
+
"lineHeight": 26,
|
|
110
112
|
"textAlign": "center",
|
|
111
113
|
},
|
|
112
114
|
undefined,
|
|
@@ -209,6 +211,7 @@ exports[`Error renders error screen with image correctly 1`] = `
|
|
|
209
211
|
"color": "#001f23",
|
|
210
212
|
"fontFamily": "RebondGrotesque-SemiBold",
|
|
211
213
|
"fontSize": 24,
|
|
214
|
+
"lineHeight": 32,
|
|
212
215
|
"marginBottom": 8,
|
|
213
216
|
"textAlign": "center",
|
|
214
217
|
},
|
|
@@ -239,6 +242,7 @@ exports[`Error renders error screen with image correctly 1`] = `
|
|
|
239
242
|
"color": "#4d6265",
|
|
240
243
|
"fontFamily": "RebondGrotesque",
|
|
241
244
|
"fontSize": 18,
|
|
245
|
+
"lineHeight": 26,
|
|
242
246
|
"textAlign": "center",
|
|
243
247
|
},
|
|
244
248
|
undefined,
|
|
@@ -357,6 +361,7 @@ exports[`Error renders full screen error page correctly 1`] = `
|
|
|
357
361
|
"color": "#001f23",
|
|
358
362
|
"fontFamily": "RebondGrotesque-SemiBold",
|
|
359
363
|
"fontSize": 24,
|
|
364
|
+
"lineHeight": 32,
|
|
360
365
|
"marginBottom": 8,
|
|
361
366
|
"textAlign": "center",
|
|
362
367
|
},
|
|
@@ -387,6 +392,7 @@ exports[`Error renders full screen error page correctly 1`] = `
|
|
|
387
392
|
"color": "#4d6265",
|
|
388
393
|
"fontFamily": "RebondGrotesque",
|
|
389
394
|
"fontSize": 18,
|
|
395
|
+
"lineHeight": 26,
|
|
390
396
|
"textAlign": "center",
|
|
391
397
|
},
|
|
392
398
|
undefined,
|
|
@@ -451,6 +457,7 @@ exports[`Error renders title only correctly 1`] = `
|
|
|
451
457
|
"color": "#001f23",
|
|
452
458
|
"fontFamily": "RebondGrotesque-SemiBold",
|
|
453
459
|
"fontSize": 24,
|
|
460
|
+
"lineHeight": 32,
|
|
454
461
|
"marginBottom": 8,
|
|
455
462
|
"textAlign": "center",
|
|
456
463
|
},
|
|
@@ -481,6 +488,7 @@ exports[`Error renders title only correctly 1`] = `
|
|
|
481
488
|
"color": "#4d6265",
|
|
482
489
|
"fontFamily": "RebondGrotesque",
|
|
483
490
|
"fontSize": 18,
|
|
491
|
+
"lineHeight": 26,
|
|
484
492
|
"textAlign": "center",
|
|
485
493
|
},
|
|
486
494
|
undefined,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
import { Animated, Easing, StyleSheet } from 'react-native';
|
|
2
|
+
import { Animated, Easing, Platform, StyleSheet } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { StyledSpinnerDot, StyledSpinnerRow } from './StyledSpinner';
|
|
5
5
|
|
|
@@ -22,7 +22,7 @@ const AnimatedSpinner = ({
|
|
|
22
22
|
toValue: 1,
|
|
23
23
|
duration: 1200,
|
|
24
24
|
easing: Easing.linear,
|
|
25
|
-
useNativeDriver:
|
|
25
|
+
useNativeDriver: Platform.OS !== 'web',
|
|
26
26
|
})
|
|
27
27
|
);
|
|
28
28
|
|
|
@@ -34,7 +34,12 @@ const getErrorTheme = (theme: GlobalTheme) => {
|
|
|
34
34
|
description: theme.fonts.playful.regular,
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
const lineHeight = {
|
|
38
|
+
title: theme.lineHeights.xxxlarge,
|
|
39
|
+
description: theme.lineHeights.xlarge,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return { fontSizes, colors, sizes, space, fonts, lineHeight };
|
|
38
43
|
};
|
|
39
44
|
|
|
40
45
|
export default getErrorTheme;
|