@hero-design/rn 8.108.3-alpha.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/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,
@@ -28393,9 +28396,11 @@ var ToolbarEvents;
28393
28396
  ToolbarEvents["HeadingOne"] = "heading-one";
28394
28397
  ToolbarEvents["HeadingTwo"] = "heading-two";
28395
28398
  })(ToolbarEvents || (ToolbarEvents = {}));
28396
-
28397
- var emitter = new events.EventEmitter();
28398
- emitter.setMaxListeners(20);
28399
+ var EditorEvents;
28400
+ (function (EditorEvents) {
28401
+ EditorEvents["EditorFocus"] = "editor-focus";
28402
+ EditorEvents["EditorBlur"] = "editor-blur";
28403
+ })(EditorEvents || (EditorEvents = {}));
28399
28404
 
28400
28405
  var StyledToolbarButton = index$c(reactNative.TouchableOpacity)(function (_ref) {
28401
28406
  var theme = _ref.theme,
@@ -28441,6 +28446,40 @@ var on = function on(emitter, eventName, listener) {
28441
28446
  };
28442
28447
  };
28443
28448
 
28449
+ var emitter = new events.EventEmitter();
28450
+ emitter.setMaxListeners(20);
28451
+
28452
+ /**
28453
+ * Hook to subscribe to events for a rich text editor
28454
+ * @param editorName - The name of the editor to subscribe to events for
28455
+ * @returns An object with two functions: emitEvent and subscribeToEvents
28456
+ * @example
28457
+ * const { emitEvent, subscribeToEvents } = useRichTextEditorEvents('editorName');
28458
+ * subscribeToEvents(EditorEvents.EditorFocus, () => {
28459
+ * console.log('Editor focused');
28460
+ * });
28461
+ * emitEvent({ type: EditorEvents.EditorFocus, data: null });
28462
+ */
28463
+ var useRichTextEditorEvents = function useRichTextEditorEvents(editorName) {
28464
+ var normalizeEventName = React.useCallback(function (event) {
28465
+ return "".concat(editorName, "/").concat(event);
28466
+ }, [editorName]);
28467
+ var subscribeToEvents = React.useCallback(function (eventName, onEvent) {
28468
+ return on(emitter, normalizeEventName(eventName), function (eventData) {
28469
+ onEvent(eventData);
28470
+ });
28471
+ }, [normalizeEventName]);
28472
+ var emitEvent = React.useCallback(function (_ref) {
28473
+ var type = _ref.type,
28474
+ data = _ref.data;
28475
+ emit(emitter, normalizeEventName(type), data);
28476
+ }, [normalizeEventName]);
28477
+ return {
28478
+ emitEvent: emitEvent,
28479
+ subscribeToEvents: subscribeToEvents
28480
+ };
28481
+ };
28482
+
28444
28483
  var ToolbarButton = function ToolbarButton(_ref) {
28445
28484
  var icon = _ref.icon,
28446
28485
  onPress = _ref.onPress,
@@ -28510,14 +28549,14 @@ var EditorToolbar = function EditorToolbar(_ref2) {
28510
28549
  _useState4 = _slicedToArray(_useState3, 2),
28511
28550
  toolbarButtonArray = _useState4[0],
28512
28551
  setToolbarButtonArray = _useState4[1];
28513
- var normalizeEventName = React.useCallback(function (event) {
28514
- return "".concat(name, "/").concat(event);
28515
- }, [name]);
28552
+ var _useRichTextEditorEve = useRichTextEditorEvents(name),
28553
+ emitEvent = _useRichTextEditorEve.emitEvent,
28554
+ subscribeToEvents = _useRichTextEditorEve.subscribeToEvents;
28516
28555
  React.useEffect(function () {
28517
- var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
28556
+ var removeFocusListener = subscribeToEvents(EditorEvents.EditorFocus, function () {
28518
28557
  return setShow(true);
28519
28558
  });
28520
- var removeBlurListener = on(emitter, normalizeEventName('editor-blur'), function () {
28559
+ var removeBlurListener = subscribeToEvents(EditorEvents.EditorBlur, function () {
28521
28560
  return setShow(false);
28522
28561
  });
28523
28562
  return function () {
@@ -28560,7 +28599,10 @@ var EditorToolbar = function EditorToolbar(_ref2) {
28560
28599
  icon: config.icon,
28561
28600
  onPress: function onPress() {
28562
28601
  toggleToolbarButton(button);
28563
- emit(emitter, normalizeEventName(config.eventName), null);
28602
+ emitEvent({
28603
+ type: config.eventName,
28604
+ data: null
28605
+ });
28564
28606
  },
28565
28607
  selected: button.selected
28566
28608
  });
@@ -28582,7 +28624,7 @@ var isEmptyString = function isEmptyString(s) {
28582
28624
  var MentionList = function MentionList(_ref) {
28583
28625
  var eventPrefix = _ref.name,
28584
28626
  render = _ref.render;
28585
- var theme = useTheme$1();
28627
+ var theme = useTheme();
28586
28628
  var _useState = React.useState(''),
28587
28629
  _useState2 = _slicedToArray(_useState, 2),
28588
28630
  search = _useState2[0],
@@ -28615,7 +28657,7 @@ var MentionList = function MentionList(_ref) {
28615
28657
  var highlighted = options.highlighted,
28616
28658
  meta = options.meta;
28617
28659
  var highlightStyle = {
28618
- color: theme.colors.secondary,
28660
+ color: theme.colors.primary,
28619
28661
  borderRadius: theme.__hd__.richTextEditor.radii.mention,
28620
28662
  padding: highlighted ? theme.__hd__.richTextEditor.space.mention : 0,
28621
28663
  background: highlighted ? theme.colors.highlightedSurface : 'transparent',
@@ -47340,8 +47382,7 @@ var StyledWebView = index$c(reactNativeWebview.WebView)(function (_ref2) {
47340
47382
  minHeight: theme.__hd__.richTextEditor.sizes.editorMinHeight,
47341
47383
  backgroundColor: 'transparent',
47342
47384
  textAlignVertical: 'center',
47343
- fontSize: theme.__hd__.textInput.fontSizes.text,
47344
- marginHorizontal: theme.__hd__.textInput.space.inputHorizontalMargin
47385
+ fontSize: theme.__hd__.textInput.fontSizes.text
47345
47386
  };
47346
47387
  });
47347
47388
 
@@ -47353,13 +47394,13 @@ var postMessage = function postMessage(element, message) {
47353
47394
  element.injectJavaScript("window.postMessage(".concat(messageString, ", '*');"));
47354
47395
  };
47355
47396
 
47356
- var defaultValue = [{
47397
+ var defaultValue$1 = [{
47357
47398
  type: 'paragraph',
47358
47399
  children: [{
47359
47400
  text: ''
47360
47401
  }]
47361
47402
  }];
47362
- var RichTextEditor = function RichTextEditor(_ref) {
47403
+ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
47363
47404
  var _ref$autoFocus = _ref.autoFocus,
47364
47405
  autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
47365
47406
  name = _ref.name,
@@ -47367,18 +47408,15 @@ var RichTextEditor = function RichTextEditor(_ref) {
47367
47408
  placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
47368
47409
  onChange = _ref.onChange,
47369
47410
  onCursorChange = _ref.onCursorChange,
47370
- _ref$error = _ref.error,
47371
- error = _ref$error === void 0 ? '' : _ref$error,
47372
47411
  _ref$style = _ref.style,
47373
47412
  style = _ref$style === void 0 ? {} : _ref$style,
47374
- label = _ref.label,
47375
- helpText = _ref.helpText,
47376
- required = _ref.required,
47377
47413
  testID = _ref.testID,
47378
- forwardedRef = _ref.forwardedRef,
47414
+ editorRef = _ref.editorRef,
47379
47415
  _ref$value = _ref.value,
47380
- value = _ref$value === void 0 ? defaultValue : _ref$value;
47381
- var theme = useTheme$1();
47416
+ value = _ref$value === void 0 ? defaultValue$1 : _ref$value,
47417
+ onFocus = _ref.onFocus,
47418
+ onBlur = _ref.onBlur;
47419
+ var theme = useTheme();
47382
47420
  var webview = React.useRef(null);
47383
47421
  var _useState = React.useState(),
47384
47422
  _useState2 = _slicedToArray(_useState, 2),
@@ -47388,18 +47426,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
47388
47426
  _useState4 = _slicedToArray(_useState3, 2),
47389
47427
  isFocused = _useState4[0],
47390
47428
  setIsFocused = _useState4[1];
47391
- var isEmptyValue = React.useMemo(function () {
47392
- return libExports.isEmptyContent(value);
47393
- }, [value]);
47394
- var state = React.useMemo(function () {
47395
- if (error) {
47396
- return 'error';
47397
- }
47398
- if (isEmptyValue) {
47399
- return 'filled';
47400
- }
47401
- return 'default';
47402
- }, [isFocused, error, isEmptyValue]);
47403
47429
  var normalizeEventName = function normalizeEventName(event) {
47404
47430
  return "".concat(name, "/").concat(event);
47405
47431
  };
@@ -47408,45 +47434,6 @@ var RichTextEditor = function RichTextEditor(_ref) {
47408
47434
  postMessage(webview.current, message);
47409
47435
  }
47410
47436
  };
47411
- var _React$useState = React__namespace.default.useState({
47412
- height: 0,
47413
- width: 0
47414
- }),
47415
- _React$useState2 = _slicedToArray(_React$useState, 2),
47416
- inputSize = _React$useState2[0],
47417
- setInputSize = _React$useState2[1];
47418
- var focusAnimation = React.useRef(new reactNative.Animated.Value(0)).current;
47419
- React.useEffect(function () {
47420
- reactNative.Animated.timing(focusAnimation, {
47421
- toValue: isFocused || !isEmptyValue ? 1 : 0,
47422
- duration: LABEL_ANIMATION_DURATION,
47423
- easing: reactNative.Easing.bezier(0.4, 0, 0.2, 1),
47424
- useNativeDriver: true
47425
- }).start();
47426
- }, [focusAnimation, isEmptyValue, isFocused]);
47427
- var onLayout = React.useCallback(function (event) {
47428
- var _event$nativeEvent$la = event.nativeEvent.layout,
47429
- height = _event$nativeEvent$la.height,
47430
- width = _event$nativeEvent$la.width;
47431
- setInputSize(function (prev) {
47432
- return _objectSpread2(_objectSpread2({}, prev), {}, {
47433
- height: height,
47434
- width: width
47435
- });
47436
- });
47437
- }, []);
47438
- React.useEffect(function () {
47439
- var removeFocusListener = on(emitter, normalizeEventName('editor-focus'), function () {
47440
- return setIsFocused(true);
47441
- });
47442
- var removeBlurListener = on(emitter, normalizeEventName('editor-blur'), function () {
47443
- return setIsFocused(false);
47444
- });
47445
- return function () {
47446
- removeFocusListener();
47447
- removeBlurListener();
47448
- };
47449
- }, []);
47450
47437
  var html = React.useMemo(function () {
47451
47438
  var initialValueString = JSON.stringify(value);
47452
47439
  return "\n <!DOCTYPE html>\n <html>\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0\">\n <style>\n body {\n margin: 0;\n }\n </style>\n </head>\n <body>\n <div id=\"root\"></div>\n <script>\n window.__editorConfigs = {\n placeholder: \"".concat(placeholder, "\",\n initialValue: ").concat(initialValueString, ",\n isAndroid: ").concat(isAndroid ? 'true' : 'false', ",\n autoFocus: ").concat(autoFocus, ",\n style: {\n padding: '0 !important',\n fontSize: ").concat(theme.__hd__.richTextEditor.fontSizes.editor, ",\n color: '").concat(theme.__hd__.richTextEditor.colors.text, "'\n }\n };\n ").concat(heroEditorApp, "\n </script>\n </body>\n </html>\n ");
@@ -47480,7 +47467,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
47480
47467
  }
47481
47468
  });
47482
47469
  }, []);
47483
- React.useImperativeHandle(forwardedRef, function () {
47470
+ React.useImperativeHandle(editorRef, function () {
47484
47471
  return {
47485
47472
  requestBlur: requestBlur,
47486
47473
  insertNodes: insertNodes,
@@ -47528,9 +47515,13 @@ var RichTextEditor = function RichTextEditor(_ref) {
47528
47515
  var messageData = message === null || message === void 0 ? void 0 : message.data;
47529
47516
  switch (messageType) {
47530
47517
  case '@hero-editor/webview/editor-focus':
47518
+ onFocus === null || onFocus === void 0 || onFocus();
47519
+ setIsFocused(true);
47531
47520
  emit(emitter, normalizeEventName('editor-focus'), undefined);
47532
47521
  break;
47533
47522
  case '@hero-editor/webview/editor-blur':
47523
+ onBlur === null || onBlur === void 0 || onBlur();
47524
+ setIsFocused(false);
47534
47525
  emit(emitter, normalizeEventName('editor-blur'), undefined);
47535
47526
  break;
47536
47527
  case '@hero-editor/webview/mention-search':
@@ -47548,7 +47539,107 @@ var RichTextEditor = function RichTextEditor(_ref) {
47548
47539
  handleEditorLayoutEvent(messageData);
47549
47540
  break;
47550
47541
  }
47542
+ }, [onFocus, onBlur]);
47543
+ return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableWithoutFeedback, {
47544
+ onPress: function onPress(e) {
47545
+ return e.stopPropagation();
47546
+ }
47547
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledWebView, {
47548
+ hideKeyboardAccessoryView: true,
47549
+ ref: webview,
47550
+ testID: testID,
47551
+ source: {
47552
+ html: html
47553
+ },
47554
+ onMessage: onMessage,
47555
+ scrollEnabled: false,
47556
+ originWhitelist: ['*'],
47557
+ keyboardDisplayRequiresUserAction: false,
47558
+ style: reactNative.StyleSheet.flatten([style, {
47559
+ height: webviewHeight
47560
+ }])
47561
+ }));
47562
+ };
47563
+
47564
+ var defaultValue = [{
47565
+ type: 'paragraph',
47566
+ children: [{
47567
+ text: ''
47568
+ }]
47569
+ }];
47570
+ var RichTextEditor = function RichTextEditor(_ref) {
47571
+ var _ref$autoFocus = _ref.autoFocus,
47572
+ autoFocus = _ref$autoFocus === void 0 ? true : _ref$autoFocus,
47573
+ name = _ref.name,
47574
+ _ref$placeholder = _ref.placeholder,
47575
+ placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
47576
+ onChange = _ref.onChange,
47577
+ onCursorChange = _ref.onCursorChange,
47578
+ _ref$error = _ref.error,
47579
+ error = _ref$error === void 0 ? '' : _ref$error,
47580
+ _ref$style = _ref.style,
47581
+ style = _ref$style === void 0 ? {} : _ref$style,
47582
+ label = _ref.label,
47583
+ helpText = _ref.helpText,
47584
+ required = _ref.required,
47585
+ testID = _ref.testID,
47586
+ onFocus = _ref.onFocus,
47587
+ onBlur = _ref.onBlur,
47588
+ forwardedRef = _ref.forwardedRef,
47589
+ _ref$value = _ref.value,
47590
+ value = _ref$value === void 0 ? defaultValue : _ref$value;
47591
+ var theme = useTheme();
47592
+ var _useState = React.useState(false),
47593
+ _useState2 = _slicedToArray(_useState, 2),
47594
+ isFocused = _useState2[0],
47595
+ setIsFocused = _useState2[1];
47596
+ var isEmptyValue = React.useMemo(function () {
47597
+ return libExports.isEmptyContent(value);
47598
+ }, [value]);
47599
+ var state = React.useMemo(function () {
47600
+ if (error) {
47601
+ return 'error';
47602
+ }
47603
+ if (isEmptyValue) {
47604
+ return 'filled';
47605
+ }
47606
+ return 'default';
47607
+ }, [isFocused, error, isEmptyValue]);
47608
+ var _React$useState = React__namespace.default.useState({
47609
+ height: 0,
47610
+ width: 0
47611
+ }),
47612
+ _React$useState2 = _slicedToArray(_React$useState, 2),
47613
+ inputSize = _React$useState2[0],
47614
+ setInputSize = _React$useState2[1];
47615
+ var focusAnimation = React.useRef(new reactNative.Animated.Value(0)).current;
47616
+ React.useEffect(function () {
47617
+ reactNative.Animated.timing(focusAnimation, {
47618
+ toValue: isFocused || !isEmptyValue ? 1 : 0,
47619
+ duration: LABEL_ANIMATION_DURATION,
47620
+ easing: reactNative.Easing.bezier(0.4, 0, 0.2, 1),
47621
+ useNativeDriver: true
47622
+ }).start();
47623
+ }, [focusAnimation, isEmptyValue, isFocused]);
47624
+ var onLayout = React.useCallback(function (event) {
47625
+ var _event$nativeEvent$la = event.nativeEvent.layout,
47626
+ height = _event$nativeEvent$la.height,
47627
+ width = _event$nativeEvent$la.width;
47628
+ setInputSize(function (prev) {
47629
+ return _objectSpread2(_objectSpread2({}, prev), {}, {
47630
+ height: height,
47631
+ width: width
47632
+ });
47633
+ });
47551
47634
  }, []);
47635
+ var handleEditorFocus = React.useCallback(function () {
47636
+ onFocus === null || onFocus === void 0 || onFocus();
47637
+ setIsFocused(true);
47638
+ }, [onFocus]);
47639
+ var handleEditorBlur = React.useCallback(function () {
47640
+ onBlur === null || onBlur === void 0 || onBlur();
47641
+ setIsFocused(false);
47642
+ }, [onBlur]);
47552
47643
  return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$6, {
47553
47644
  testID: testID
47554
47645
  }, /*#__PURE__*/React__namespace.default.createElement(StyledLabelContainerInsideTextInput, {
@@ -47590,27 +47681,22 @@ var RichTextEditor = function RichTextEditor(_ref) {
47590
47681
  themeState: state,
47591
47682
  themeFocused: isFocused
47592
47683
  }), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputAndLabelContainer, {
47593
- style: {
47594
- height: webviewHeight
47595
- },
47596
47684
  testID: "webViewWrapper"
47597
- }, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableWithoutFeedback, {
47598
- onPress: function onPress(e) {
47599
- return e.stopPropagation();
47600
- }
47601
- }, /*#__PURE__*/React__namespace.default.createElement(StyledWebView, {
47602
- ref: webview,
47685
+ }, /*#__PURE__*/React__namespace.default.createElement(BaseRichTextEditor, {
47686
+ name: name,
47687
+ value: value,
47688
+ style: [style, {
47689
+ marginHorizontal: theme.__hd__.textInput.space.inputHorizontalMargin
47690
+ }],
47603
47691
  testID: "webview",
47604
- style: style,
47605
- originWhitelist: ['*'],
47606
- source: {
47607
- html: html
47608
- },
47609
- onMessage: onMessage,
47610
- scrollEnabled: false,
47611
- hideKeyboardAccessoryView: true,
47612
- keyboardDisplayRequiresUserAction: false
47613
- })))), /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndMaxLengthContainer, null, error ? /*#__PURE__*/React__namespace.default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__namespace.default.createElement(Icon, {
47692
+ onChange: onChange,
47693
+ autoFocus: autoFocus,
47694
+ editorRef: forwardedRef,
47695
+ placeholder: placeholder,
47696
+ onBlur: handleEditorBlur,
47697
+ onFocus: handleEditorFocus,
47698
+ onCursorChange: onCursorChange
47699
+ }))), /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndMaxLengthContainer, null, error ? /*#__PURE__*/React__namespace.default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__namespace.default.createElement(Icon, {
47614
47700
  testID: "input-error-icon",
47615
47701
  icon: "circle-info",
47616
47702
  size: "xsmall",
@@ -47627,8 +47713,12 @@ var RichTextEditorWithRef = /*#__PURE__*/React.forwardRef(function (props, ref)
47627
47713
  RichTextEditorWithRef.displayName = 'RichTextEditor';
47628
47714
 
47629
47715
  var index = Object.assign(RichTextEditorWithRef, {
47716
+ Toolbar: EditorToolbar,
47630
47717
  MentionList: MentionList,
47631
- Toolbar: EditorToolbar
47718
+ EditorEvents: EditorEvents,
47719
+ ToolbarEvents: ToolbarEvents,
47720
+ useRichTextEditorEvents: useRichTextEditorEvents,
47721
+ Base: BaseRichTextEditor
47632
47722
  });
47633
47723
 
47634
47724
  var LAST_BREAKPOINT = 100;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.108.3-alpha.0",
3
+ "version": "8.109.1",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -22,7 +22,7 @@
22
22
  "@emotion/native": "^11.9.3",
23
23
  "@emotion/primitives-core": "11.0.0",
24
24
  "@emotion/react": "^11.9.3",
25
- "@hero-design/colors": "8.46.3-alpha.0",
25
+ "@hero-design/colors": "8.46.2",
26
26
  "d3": "^7.8.5",
27
27
  "date-fns": "^2.30.0",
28
28
  "hero-editor": "^1.16.0",
@@ -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