react-native-hyperlink icon indicating copy to clipboard operation
react-native-hyperlink copied to clipboard

When used on Web, error about prop types appear.

Open Njaah-0 opened this issue 5 years ago • 1 comments

Describe the bug This error is given on Web: Failed prop type: Hyperlink: prop type linkStyle is invalid; it must be a function, usually from the prop-types package, but received undefined. in Hyperlink (created by _default)

This happens because Text.propTypes is no longer a thing in latest RNW.

To Reproduce Try using this package with latest RNW.

Expected behavior No error should be logged

Additional info I patched this in my own project by simply doing this: linkStyle: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].number]),

Njaah-0 avatar Dec 06 '20 18:12 Njaah-0

I can confirm this patch works, but creates a new warning if you happen to use react-native-hyperlink on both web and native in the same project. I would suggest you remove the PropType for linkStyle altogether as a workaround.

  1. Edit node_modules/react-native-hyperlink/src/Hyperlink.js
  2. Remove the line with linkStyle: textPropTypes.style,
  3. Make your patch persistent somehow, e.g. npx patch-package react-native-hyperlink

brandonpearcy avatar Dec 18 '20 18:12 brandonpearcy

the latest version v0.0.22 has the fix with types.

obipawan avatar Aug 22 '22 15:08 obipawan

Hi @obipawan do you know when v0.0.22 will be released?

duggster avatar Sep 03 '22 20:09 duggster