@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.
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +6 -0
- package/es/index.js +4 -1
- package/lib/index.js +4 -1
- package/package.json +1 -1
- package/src/components/Button/Button.tsx +3 -2
- package/src/components/Button/__tests__/Button.spec.tsx +9 -0
- package/stats/8.109.0/rn-stats.html +1 -3
- package/stats/8.109.1/rn-stats.html +4842 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(node:
|
|
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
|
[36m
|
|
4
4
|
[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
@@ -9,9 +9,9 @@ node_modules/d3-selection/src/selection/index.js -> node_modules/d3-selection/sr
|
|
|
9
9
|
...and 12 more
|
|
10
10
|
[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
|
|
11
11
|
[1m[33m(!) [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.[39m[22m
|
|
12
|
-
[32mcreated [1mlib/index.js, es/index.js[22m in [1m1m 12.
|
|
12
|
+
[32mcreated [1mlib/index.js, es/index.js[22m in [1m1m 12.6s[22m[39m
|
|
13
13
|
[36m
|
|
14
14
|
[1m/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[22m → [1m., .[22m...[39m
|
|
15
15
|
[1m[33m(!) Generated empty chunks[39m[22m
|
|
16
16
|
"locales/types" and "locales/types"
|
|
17
|
-
[32mcreated [1m., .[22m in [
|
|
17
|
+
[32mcreated [1m., .[22m in [1m21.1s[22m[39m
|
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:
|
|
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:
|
|
11016
|
+
onPress: handlePress,
|
|
11014
11017
|
testID: testID,
|
|
11015
11018
|
themeButtonVariant: themeVariant,
|
|
11016
11019
|
style: style,
|
package/package.json
CHANGED
|
@@ -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={
|
|
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
|
|