@hero-design/rn 8.30.4 → 9.1.0-rc.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.
@@ -57,13 +57,13 @@ exports[`Skeleton renders correctly by default 1`] = `
57
57
  }
58
58
  style={
59
59
  Object {
60
- "height": "100%",
60
+ "height": 0,
61
61
  "transform": Array [
62
62
  Object {
63
63
  "translateX": -0,
64
64
  },
65
65
  ],
66
- "width": "100%",
66
+ "width": 0,
67
67
  }
68
68
  }
69
69
  />
@@ -128,13 +128,13 @@ exports[`Skeleton renders correctly when intent is dark and variant is circular
128
128
  }
129
129
  style={
130
130
  Object {
131
- "height": "100%",
131
+ "height": 0,
132
132
  "transform": Array [
133
133
  Object {
134
134
  "translateX": -0,
135
135
  },
136
136
  ],
137
- "width": "100%",
137
+ "width": 0,
138
138
  }
139
139
  }
140
140
  />
@@ -199,13 +199,13 @@ exports[`Skeleton renders correctly when intent is dark and variant is rectangul
199
199
  }
200
200
  style={
201
201
  Object {
202
- "height": "100%",
202
+ "height": 0,
203
203
  "transform": Array [
204
204
  Object {
205
205
  "translateX": -0,
206
206
  },
207
207
  ],
208
- "width": "100%",
208
+ "width": 0,
209
209
  }
210
210
  }
211
211
  />
@@ -270,13 +270,13 @@ exports[`Skeleton renders correctly when intent is dark and variant is rounded 1
270
270
  }
271
271
  style={
272
272
  Object {
273
- "height": "100%",
273
+ "height": 0,
274
274
  "transform": Array [
275
275
  Object {
276
276
  "translateX": -0,
277
277
  },
278
278
  ],
279
- "width": "100%",
279
+ "width": 0,
280
280
  }
281
281
  }
282
282
  />
@@ -341,13 +341,13 @@ exports[`Skeleton renders correctly when intent is light and variant is circular
341
341
  }
342
342
  style={
343
343
  Object {
344
- "height": "100%",
344
+ "height": 0,
345
345
  "transform": Array [
346
346
  Object {
347
347
  "translateX": -0,
348
348
  },
349
349
  ],
350
- "width": "100%",
350
+ "width": 0,
351
351
  }
352
352
  }
353
353
  />
@@ -412,13 +412,13 @@ exports[`Skeleton renders correctly when intent is light and variant is rectangu
412
412
  }
413
413
  style={
414
414
  Object {
415
- "height": "100%",
415
+ "height": 0,
416
416
  "transform": Array [
417
417
  Object {
418
418
  "translateX": -0,
419
419
  },
420
420
  ],
421
- "width": "100%",
421
+ "width": 0,
422
422
  }
423
423
  }
424
424
  />
@@ -483,13 +483,13 @@ exports[`Skeleton renders correctly when intent is light and variant is rounded
483
483
  }
484
484
  style={
485
485
  Object {
486
- "height": "100%",
486
+ "height": 0,
487
487
  "transform": Array [
488
488
  Object {
489
489
  "translateX": -0,
490
490
  },
491
491
  ],
492
- "width": "100%",
492
+ "width": 0,
493
493
  }
494
494
  }
495
495
  />
@@ -69,6 +69,9 @@ const Skeleton = ({
69
69
  const [containerWidth, setContainerWidth] = useState(
70
70
  Number(StyleSheet.flatten(style)?.width) || 0
71
71
  );
72
+ const [containerHeight, setContainerHeight] = useState(
73
+ Number(StyleSheet.flatten(style)?.height) || 0
74
+ );
72
75
 
73
76
  const [shouldStartAnimation, setShouldStartAnimation] = useState(false);
74
77
 
@@ -93,7 +96,8 @@ const Skeleton = ({
93
96
  });
94
97
 
95
98
  const onContainerLayout = useCallback((e: LayoutChangeEvent) => {
96
- const { width } = e.nativeEvent.layout;
99
+ const { width, height } = e.nativeEvent.layout;
100
+ setContainerHeight(height);
97
101
  setContainerWidth(width);
98
102
 
99
103
  if (!shouldStartAnimation) {
@@ -116,8 +120,8 @@ const Skeleton = ({
116
120
  start={gradientPositions.start}
117
121
  end={gradientPositions.end}
118
122
  style={{
119
- width: '100%',
120
- height: '100%',
123
+ width: containerWidth,
124
+ height: containerHeight,
121
125
  transform: [{ translateX }],
122
126
  }}
123
127
  colors={colors}
package/src/types.ts CHANGED
@@ -15,6 +15,8 @@ import type {
15
15
  import { SwipeableProps } from './components/Swipeable';
16
16
  import { TextProps } from './components/Typography/Text';
17
17
  import { CardCarouselHandles } from './components/Carousel/CardCarousel';
18
+ import { FABHandles } from './components/FAB/FAB';
19
+ import { ActionGroupHandles } from './components/FAB/ActionGroup';
18
20
 
19
21
  export type {
20
22
  BottomNavigationTabType,
@@ -32,4 +34,6 @@ export type {
32
34
  TextInputHandles,
33
35
  Theme,
34
36
  CardCarouselHandles,
37
+ FABHandles,
38
+ ActionGroupHandles,
35
39
  };
@@ -11,6 +11,7 @@ jest.mock('react-native', () => {
11
11
  const RN = jest.requireActual('react-native');
12
12
 
13
13
  const mockedAnimatedFunctions = {
14
+ setImmediate: () => jest.fn(),
14
15
  start: () => jest.fn(),
15
16
  stop: () => jest.fn(),
16
17
  _isUsingNativeDriver: () => jest.fn(),
@@ -19,6 +20,7 @@ jest.mock('react-native', () => {
19
20
 
20
21
  RN.Animated.timing = () => mockedAnimatedFunctions;
21
22
  RN.Animated.spring = () => mockedAnimatedFunctions;
23
+ RN.Animated.stagger = () => mockedAnimatedFunctions;
22
24
 
23
25
  return RN;
24
26
  });
@@ -14,7 +14,7 @@ declare const StyledActionGroupContainer: import("@emotion/native").StyledCompon
14
14
  theme?: import("@emotion/react").Theme | undefined;
15
15
  as?: import("react").ElementType<any> | undefined;
16
16
  }, {}, {}>;
17
- declare const StyledFAB: import("@emotion/native").StyledComponent<import("../FAB").FABProps & {
17
+ declare const StyledFAB: import("@emotion/native").StyledComponent<import("../FAB").FABProps & import("react").RefAttributes<import("../FAB").FABHandles> & {
18
18
  theme?: import("@emotion/react").Theme | undefined;
19
19
  as?: import("react").ElementType<any> | undefined;
20
20
  }, {}, {}>;
@@ -1,6 +1,12 @@
1
+ import React from 'react';
1
2
  import type { StyleProp, ViewStyle } from 'react-native';
2
3
  import type { IconName } from '../../Icon';
3
4
  import type { ActionItemProps } from './ActionItem';
5
+ export declare type ActionGroupHandles = {
6
+ showFAB: () => void;
7
+ collapseFAB: () => void;
8
+ hideFAB: () => void;
9
+ };
4
10
  export interface ActionGroupProps {
5
11
  /**
6
12
  * Title of the action group header.
@@ -35,5 +41,5 @@ export interface ActionGroupProps {
35
41
  */
36
42
  testID?: string;
37
43
  }
38
- declare const ActionGroup: ({ headerTitle, onPress, active, style, items, testID, fabTitle, fabIcon, }: ActionGroupProps) => JSX.Element;
44
+ declare const ActionGroup: React.ForwardRefExoticComponent<ActionGroupProps & React.RefAttributes<ActionGroupHandles>>;
39
45
  export default ActionGroup;
@@ -1,5 +1,11 @@
1
- import type { StyleProp, ViewStyle } from 'react-native';
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
2
3
  import type { IconName } from '../Icon';
4
+ export declare type FABHandles = {
5
+ show: () => void;
6
+ collapse: () => void;
7
+ hide: () => void;
8
+ };
3
9
  export interface FABProps {
4
10
  /**
5
11
  * Name of the Icon.
@@ -30,5 +36,5 @@ export interface FABProps {
30
36
  */
31
37
  testID?: string;
32
38
  }
33
- declare const FAB: ({ onPress, title, icon, animated, testID, active, style, }: FABProps) => JSX.Element;
39
+ declare const FAB: React.ForwardRefExoticComponent<FABProps & React.RefAttributes<FABHandles>>;
34
40
  export default FAB;
@@ -1,4 +1,5 @@
1
- declare const _default: (({ onPress, title, icon, animated, testID, active, style, }: import("./FAB").FABProps) => JSX.Element) & {
2
- ActionGroup: ({ headerTitle, onPress, active, style, items, testID, fabTitle, fabIcon, }: import("./ActionGroup").ActionGroupProps) => JSX.Element;
1
+ /// <reference types="react" />
2
+ declare const _default: import("react").ForwardRefExoticComponent<import("./FAB").FABProps & import("react").RefAttributes<import("./FAB").FABHandles>> & {
3
+ ActionGroup: import("react").ForwardRefExoticComponent<import("./ActionGroup").ActionGroupProps & import("react").RefAttributes<import("./ActionGroup").ActionGroupHandles>>;
3
4
  };
4
5
  export default _default;
package/types/types.d.ts CHANGED
@@ -9,4 +9,6 @@ import type { ListRenderOptionInfo, SectionListRenderOptionInfo } from './compon
9
9
  import { SwipeableProps } from './components/Swipeable';
10
10
  import { TextProps } from './components/Typography/Text';
11
11
  import { CardCarouselHandles } from './components/Carousel/CardCarousel';
12
- export type { BottomNavigationTabType, IconName, SingleSelectProps, MultiSelectProps, ListRenderOptionInfo, SectionListRenderOptionInfo, SwipeableProps, RichTextEditorProps, RichTextEditorRef, TabType, TextInputProps, TextProps, TextInputHandles, Theme, CardCarouselHandles, };
12
+ import { FABHandles } from './components/FAB/FAB';
13
+ import { ActionGroupHandles } from './components/FAB/ActionGroup';
14
+ export type { BottomNavigationTabType, IconName, SingleSelectProps, MultiSelectProps, ListRenderOptionInfo, SectionListRenderOptionInfo, SwipeableProps, RichTextEditorProps, RichTextEditorRef, TabType, TextInputProps, TextProps, TextInputHandles, Theme, CardCarouselHandles, FABHandles, ActionGroupHandles, };