Files
flipper/desktop/patches/antd+4.18.2.patch
Pascal Hartig cb6d9c9d90 Update antd patch
Summary: Result of `yarn patch-package antd` to mute the scary warning.

Reviewed By: antonk52

Differential Revision: D33660054

fbshipit-source-id: 9ee8aaecb9c2ed25722744c3b416ec2e32332002
2022-01-19 11:05:06 -08:00

58 lines
1.9 KiB
Diff

diff --git a/node_modules/antd/es/button/button.js b/node_modules/antd/es/button/button.js
index 7202fce..c70b419 100644
--- a/node_modules/antd/es/button/button.js
+++ b/node_modules/antd/es/button/button.js
@@ -187,6 +187,8 @@ var InternalButton = function InternalButton(props, ref) {
}, [loadingOrDelay]);
React.useEffect(fixTwoCNChar, [buttonRef]);
+ var scope = React.useContext(global.FlipperTrackingScopeContext);
+
var handleClick = function handleClick(e) {
var _a;
@@ -198,7 +200,13 @@ var InternalButton = function InternalButton(props, ref) {
return;
}
- (_a = onClick) === null || _a === void 0 ? void 0 : _a(e);
+ if(onClick !== null && onClick !== void 0) {
+ global.flipperTrackInteraction(
+ 'Button', 'onClick', scope, props.title || props.children || props.icon,
+ onClick,
+ e
+ );
+ }
};
devWarning(!(typeof icon === 'string' && icon.length > 2), 'Button', "`icon` is using ReactNode instead of string naming in v4. Please check `".concat(icon, "` at https://ant.design/components/icon"));
diff --git a/node_modules/antd/es/typography/Link.js b/node_modules/antd/es/typography/Link.js
index 2847840..c58480a 100644
--- a/node_modules/antd/es/typography/Link.js
+++ b/node_modules/antd/es/typography/Link.js
@@ -36,12 +36,23 @@ var Link = function Link(_a, ref) {
}); // https://github.com/ant-design/ant-design/issues/26622
// @ts-ignore
+ var onClick = React.useCallback((e) => {
+ if (mergedProps.onClick) {
+ return mergedProps.onClick(e);
+ }
+ if (mergedProps.href) {
+ global.flipperOpenLink(mergedProps.href);
+ e.preventDefault();
+ e.stopPropagation();
+ };
+ }, [mergedProps.href, mergedProps.onClick])
delete mergedProps.navigate;
return /*#__PURE__*/React.createElement(Base, _extends({}, mergedProps, {
ref: baseRef,
ellipsis: !!ellipsis,
- component: "a"
+ component: "a",
+ onClick: onClick,
}));
};