Skip to content

Commit

Permalink
fix(types): include bubble on press
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan-dutoit committed Apr 29, 2022
1 parent 17e23a4 commit 94ddd44
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import MaterialIcons from '@expo/vector-icons/MaterialIcons'
import * as Linking from 'expo-linking'
import AppLoading from 'expo-app-loading'
import React, { Component } from 'react'
import { StyleSheet, View, Text, Platform } from 'react-native'
import { StyleSheet, View, Text, Platform, Alert } from 'react-native'
import {
Bubble,
GiftedChat,
Expand Down Expand Up @@ -256,6 +256,9 @@ export default class App extends Component {
scrollToBottom
onLongPressAvatar={user => alert(JSON.stringify(user))}
onPressAvatar={() => alert('short press')}
onPress={() => {
Alert.alert('Bubble pressed')
}}
onQuickReply={this.onQuickReply}
keyboardShouldPersistTaps='never'
renderAccessory={Platform.OS === 'web' ? null : this.renderAccessory}
Expand Down
3 changes: 2 additions & 1 deletion flow-typedefs/GiftedChat.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ export type GiftedChatProps<TMessage: IMessage = IMessage> = $ReadOnly<{|
renderAvatar?: ((AvatarProps<TMessage>) => React.Node) | null,
renderBubble?: (BubbleProps<TMessage>) => React.Node,
renderSystemMessage?: (SystemMessageProps<TMessage>) => React.Node,
onLongPress?: (context: any, message: any) => void,
onPress?: (context: any, message: TMessage) => void,
onLongPress?: (context: any, message: TMessage) => void,
renderMessage?: (MessageProps<TMessage>) => React.Node,
renderMessageText?: (MessageTextProps<TMessage>) => React.Node,
renderMessageImage?: (MessageImageProps<TMessage>) => React.Node,
Expand Down
4 changes: 3 additions & 1 deletion src/GiftedChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@ export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
renderBubble?(props: Bubble<TMessage>['props']): React.ReactNode
/*Custom system message */
renderSystemMessage?(props: SystemMessageProps<TMessage>): React.ReactNode
/* Callback when a message bubble is pressed; default is to do nothing */
onPress?(context: any, message: TMessage): void
/* Callback when a message bubble is long-pressed; default is to show an ActionSheet with "Copy Text" (see example using showActionSheetWithOptions()) */
onLongPress?(context: any, message: any): void
onLongPress?(context: any, message: TMessage): void
/* Reverses display order of messages; default is true */
/*Custom message container */
renderMessage?(message: Message<TMessage>['props']): React.ReactNode
Expand Down

0 comments on commit 94ddd44

Please sign in to comment.