Skip to content

Commit

Permalink
Merge pull request #333 from cribspot/on-press-action-button
Browse files Browse the repository at this point in the history
Add 'onPressActionButton' prop
  • Loading branch information
kfiroo authored Jan 10, 2017
2 parents 7ac0ceb + 6ba3d59 commit 270de9b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ See [example/App.js](example/App.js)
- **`renderComposer`** _(Function)_ - render the text input message composer
- **`renderSend`** _(Function)_ - render the send button
- **`renderAccessory`** _(Function)_ - renders a second line of actions below the message composer
- **`onPressActionButton`** _(Function)_ - callback to perform custom logic when the Action button is pressed (the default `actionSheet` will not be used)
- **`bottomOffset`** _(Integer)_ - distance of the chat from the bottom of the screen, useful if you display a tab bar


Expand Down
3 changes: 2 additions & 1 deletion src/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class Actions extends React.Component {
return (
<TouchableOpacity
style={[styles.container, this.props.containerStyle]}
onPress={this.onActionsPress}
onPress={this.props.onPressActionButton || this.onActionsPress}
>
{this.renderIcon()}
</TouchableOpacity>
Expand Down Expand Up @@ -103,6 +103,7 @@ Actions.propTypes = {
options: React.PropTypes.object,
optionTintColor: React.PropTypes.string,
icon: React.PropTypes.func,
onPressActionButton: React.PropTypes.func,
containerStyle: View.propTypes.style,
iconTextStyle: Text.propTypes.style,
};
4 changes: 4 additions & 0 deletions src/InputToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import {

import Composer from './Composer';
import Send from './Send';
import Actions from './Actions';

export default class InputToolbar extends React.Component {
renderActions() {
if (this.props.renderActions) {
return this.props.renderActions(this.props);
} else if (this.props.onPressActionButton) {
return <Actions {...this.props} />;
}
return null;
}
Expand Down Expand Up @@ -89,6 +92,7 @@ InputToolbar.propTypes = {
renderActions: React.PropTypes.func,
renderSend: React.PropTypes.func,
renderComposer: React.PropTypes.func,
onPressActionButton: React.PropTypes.func,
containerStyle: View.propTypes.style,
primaryStyle: View.propTypes.style,
accessoryStyle: View.propTypes.style,
Expand Down

0 comments on commit 270de9b

Please sign in to comment.