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

Better type than any for context in onPress and onLongPress handlers. #2509

Open
xdumaine opened this issue Jul 15, 2024 · 5 comments
Open

Comments

@xdumaine
Copy link

Issue Description

Would love a better type than any for context in onPress and onLongPress handlers.

as is, context.showActionSheetWithOptions(...) doesn't have any typing.

@xdumaine
Copy link
Author

Looks like the better type is IGiftedChatContext but it's not an easy type swap due to some internals of how it's passed around and used on TouchableOpacity events.

@Varryme

This comment was marked as spam.

@Varryme

This comment was marked as spam.

@xdumaine
Copy link
Author

Related: the onPressAvatar doesn't get this param at all, as far as I can tell. It'd be useful (for action sheet). Using this doesn't work for me, weirdly it silently fails:

const { actionSheet } = useChatContext()

const onPressAvatar = useCallback((user: User) => {
  actionSheet().showActionSheetWithOptions(...) // Fails - no error, nothing shown
}, [...]);

onLongPress = useCallback((context: IGiftedChatContext, msg: IMessage) => {
  context.actionSheet().showActionSheetWithOptions(...) // works!
}, [...]);

Repository owner deleted a comment from Varryme Aug 29, 2024
@Varryme
Copy link

Varryme commented Sep 12, 2024

Great job

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

2 participants