这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@silasjmatson
Copy link
Contributor

Description

There were two issues at play here:

  1. Icon's style prop overrides the Wrapped TouchableOpacity's style prop with an incompatible StyleProp<ImageStyle>
  2. Icon changed the wrapper used based on the presence of the onPress prop, which made accurate typing and linting difficult.

See
#2888 (comment) for more information.

This commit fixes #2888 by simply separating Icon into PressableIcon and Icon components, with simplified prop types for each, and updates the docs to reflect the change.

Checklist

  • README.md and other relevant documentation has been updated with my changes

There were two issues at play here:

1. Icon's `style` prop overrides the Wrapped `TouchableOpacity`'s
`style` prop with an incompatible `StyleProp<ImageStyle>`
2. Icon changed the wrapper used based on the presence of the `onPress`
  prop, which made accurate typing and linting difficult.

See
#2888 (comment)
for more information.

This commit fixes #2888 by simply separating `Icon` into
`PressableIcon` and `Icon` components, with simplified prop types
for each, and updates the docs to reflect the change.
Copy link
Contributor

@frankcalise frankcalise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@frankcalise frankcalise merged commit 5739eb7 into master Apr 23, 2025
3 checks passed
@frankcalise frankcalise deleted the fix/icon-type-definitions branch April 23, 2025 23:41
@infinitered-circleci
Copy link
Collaborator

🎉 This PR is included in version 10.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interface 'IconProps' incorrectly extends interface 'TouchableOpacityProps'

5 participants