ui icon indicating copy to clipboard operation
ui copied to clipboard

Image.propTypes is undefined when using ImagePreview component

Open cayleyh opened this issue 8 months ago • 1 comments

PropTypes have been removed from React Native (https://github.com/react-native-community/discussions-and-proposals/issues/29). Most of Shoutem has been updated to take this into account, but some areas have been missed.

For example, in ImagePreview, line 87 exports a source propType for the component like so:

source: Image.propTypes.source

Which of course fails with a TypeError: Cannot read properties of undefined (reading 'source') error. The Shoutem Image component has been updated to use ImagePropTypes from the deprecated-react-native-prop-types package, avoiding these issues.

There are 2 potential solutions:

  1. Update ImagePreview to use the Shoutem Image component instead of the react-native component.
  2. Update ImagePreview to use ImagePropTypes from deprecated-react-native-prop-types

What is the preferred solution for the shoutem team here?

cayleyh avatar Dec 15 '23 18:12 cayleyh

While this issue is open, if anyone else encounters this issue, I have solved by method #2 using https://www.npmjs.com/package/patch-package to dynamically apply the patch to shoutem-ui on install

cayleyh avatar Dec 15 '23 18:12 cayleyh