Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image.propTypes is undefined when using ImagePreview component #795

Open
cayleyh opened this issue Dec 15, 2023 · 1 comment
Open

Image.propTypes is undefined when using ImagePreview component #795

cayleyh opened this issue Dec 15, 2023 · 1 comment

Comments

@cayleyh
Copy link

cayleyh commented Dec 15, 2023

PropTypes have been removed from React Native (react-native-community/discussions-and-proposals#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
Copy link
Author

cayleyh commented Dec 15, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant