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

Added onAvatarPress #264

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ See [example/App.js](example/App.js)
- **`renderSend`** _(Function)_ - render the send button
- **`renderAccessory`** _(Function)_ - renders a second line of actions below the message composer
- **`bottomOffset`** _(Integer)_ - distance of the chat from the bottom of the screen, useful if you display a tab bar

- **`onAvatarPress`** _(Function)_ - Called when Avatar is pressed
- **`onLongPress`** _(Function)_ - Called when message bubble is Long Pressed

## Features
- Custom components
Expand Down
3 changes: 2 additions & 1 deletion src/Avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default class Avatar extends React.Component {
return (
<GiftedAvatar
avatarStyle={StyleSheet.flatten([styles[this.props.position].image, this.props.imageStyle[this.props.position]])}
user={this.props.currentMessage.user}
user={this.props.currentMessage.user} onPress={this.props.onAvatarPress}
/>
);
}
Expand All @@ -27,6 +27,7 @@ export default class Avatar extends React.Component {
<View style={[styles[this.props.position].container, this.props.containerStyle[this.props.position]]}>
<GiftedAvatar
avatarStyle={StyleSheet.flatten([styles[this.props.position].image, this.props.imageStyle[this.props.position]])}
onPress={this.props.onAvatarPress}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We probably don't want onPress here because this is actually a blank avatar that isn't visible.

/>
</View>
);
Expand Down
2 changes: 1 addition & 1 deletion src/Bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class Bubble extends React.Component {

onLongPress() {
if (this.props.onLongPress) {
this.props.onLongPress(this.context);
this.props.onLongPress(this.props.currentMessage, this.context);
} else {
if (this.props.currentMessage.text) {
const options = [
Expand Down