@hero-design/rn 8.109.0 → 8.109.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.
@@ -1,4 +1,4 @@
1
- (node:3326) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
1
+ (node:3341) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
2
2
  (Use `node --trace-warnings ...` to show where the warning was created)
3
3
  
4
4
  src/index.ts → lib/index.js, es/index.js...
@@ -9,9 +9,9 @@ node_modules/d3-selection/src/selection/index.js -> node_modules/d3-selection/sr
9
9
  ...and 12 more
10
10
  (!) [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`.
11
11
  (!) [plugin node-resolve] preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.
12
- created lib/index.js, es/index.js in 1m 12.1s
12
+ created lib/index.js, es/index.js in 1m 12.6s
13
13
  
14
14
  /home/runner/work/hero-design/hero-design/packages/rn/src/locales/en_AU.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/en_CA.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/index.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/types.ts → ., ....
15
15
  (!) Generated empty chunks
16
16
  "locales/types" and "locales/types"
17
- created ., . in 20.9s
17
+ created ., . in 21.1s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.109.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4236](https://github.com/Thinkei/hero-design/pull/4236) [`a873d35cddd56b5302bd4d0f95a2dfa887be995e`](https://github.com/Thinkei/hero-design/commit/a873d35cddd56b5302bd4d0f95a2dfa887be995e) Thanks [@cuongnguyeneh](https://github.com/cuongnguyeneh)! - [Button] call onPress callback with no args
8
+
3
9
  ## 8.109.0
4
10
 
5
11
  ### Minor Changes
package/es/index.js CHANGED
@@ -10932,6 +10932,9 @@ var Button = function Button(_ref) {
10932
10932
  _useState2 = _slicedToArray(_useState, 2),
10933
10933
  isPressed = _useState2[0],
10934
10934
  setIsPressed = _useState2[1];
10935
+ var handlePress = useCallback(function () {
10936
+ return onPress();
10937
+ }, [onPress]);
10935
10938
  useDeprecation("Button variant ".concat(deprecatedVariants.join(', '), " are deprecated."), deprecatedVariants.includes(themeVariant));
10936
10939
  var isCompactVariant = ['filled-compact', 'outlined-compact', 'text-compact', 'inline-text-compact'].includes(variant);
10937
10940
  var isMediumVariant = ['filled-medium', 'outlined-medium', 'text-medium'].includes(variant);
@@ -10981,7 +10984,7 @@ var Button = function Button(_ref) {
10981
10984
  accessibilityLabel: accessibilityLabel,
10982
10985
  disabled: disabled || loading,
10983
10986
  loading: loading,
10984
- onPress: onPress,
10987
+ onPress: handlePress,
10985
10988
  testID: testID,
10986
10989
  themeButtonVariant: themeVariant,
10987
10990
  style: style,
package/lib/index.js CHANGED
@@ -10961,6 +10961,9 @@ var Button = function Button(_ref) {
10961
10961
  _useState2 = _slicedToArray(_useState, 2),
10962
10962
  isPressed = _useState2[0],
10963
10963
  setIsPressed = _useState2[1];
10964
+ var handlePress = React.useCallback(function () {
10965
+ return onPress();
10966
+ }, [onPress]);
10964
10967
  useDeprecation("Button variant ".concat(deprecatedVariants.join(', '), " are deprecated."), deprecatedVariants.includes(themeVariant));
10965
10968
  var isCompactVariant = ['filled-compact', 'outlined-compact', 'text-compact', 'inline-text-compact'].includes(variant);
10966
10969
  var isMediumVariant = ['filled-medium', 'outlined-medium', 'text-medium'].includes(variant);
@@ -11010,7 +11013,7 @@ var Button = function Button(_ref) {
11010
11013
  accessibilityLabel: accessibilityLabel,
11011
11014
  disabled: disabled || loading,
11012
11015
  loading: loading,
11013
- onPress: onPress,
11016
+ onPress: handlePress,
11014
11017
  testID: testID,
11015
11018
  themeButtonVariant: themeVariant,
11016
11019
  style: style,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.109.0",
3
+ "version": "8.109.1",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -1,5 +1,5 @@
1
1
  import type { ReactChild, ReactNode } from 'react';
2
- import React, { useMemo, useState } from 'react';
2
+ import React, { useCallback, useMemo, useState } from 'react';
3
3
  import type { StyleProp, ViewStyle } from 'react-native';
4
4
  import type { Theme } from '../../theme';
5
5
  import { useTheme } from '../../theme';
@@ -193,6 +193,7 @@ const Button = ({
193
193
  return isInlineText ? 'transparent' : getUnderlayColor(theme, themeVariant);
194
194
  }, [theme, themeVariant, isInlineText]);
195
195
  const [isPressed, setIsPressed] = useState(false);
196
+ const handlePress = useCallback(() => onPress(), [onPress]);
196
197
 
197
198
  useDeprecation(
198
199
  `Button variant ${deprecatedVariants.join(', ')} are deprecated.`,
@@ -282,7 +283,7 @@ const Button = ({
282
283
  accessibilityLabel={accessibilityLabel}
283
284
  disabled={disabled || loading}
284
285
  loading={loading}
285
- onPress={onPress}
286
+ onPress={handlePress}
286
287
  testID={testID}
287
288
  themeButtonVariant={themeVariant}
288
289
  style={style}
@@ -104,6 +104,15 @@ describe('Button', () => {
104
104
  fireEvent.press(getByText('A button'));
105
105
  expect(onPress).toHaveBeenCalledTimes(1);
106
106
  });
107
+
108
+ it('triggers onPress with no arguments', () => {
109
+ const onPress = jest.fn();
110
+ const { getByText } = renderWithTheme(
111
+ <Button text="A button" onPress={onPress} />
112
+ );
113
+ fireEvent.press(getByText('A button'));
114
+ expect(onPress).toHaveBeenCalledWith();
115
+ });
107
116
  });
108
117
  });
109
118