Skip to content
Open
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
7 changes: 6 additions & 1 deletion Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
StyleSheet,
ActivityIndicator,
TouchableNativeFeedback,
Keyboard,
Platform
} from 'react-native';
import isEqual from 'lodash.isequal';
Expand All @@ -30,6 +31,7 @@ const Button = React.createClass({
delayLongPress: PropTypes.number,
delayPressIn: PropTypes.number,
delayPressOut: PropTypes.number,
dismissKeyboard: PropTypes.bool,
onPress: PropTypes.func,
onLongPress: PropTypes.func,
onPressIn: PropTypes.func,
Expand Down Expand Up @@ -94,7 +96,10 @@ const Button = React.createClass({
let touchableProps = {
accessibilityLabel: this.props.accessibilityLabel,
onPress: this.props.onPress,
onPressIn: this.props.onPressIn,
onPressIn: () => {
this.props.dismissKeyboard && Keyboard.dismiss();
this.props.onPressIn && this.props.onPressIn();
},
onPressOut: this.props.onPressOut,
onLongPress: this.props.onLongPress,
activeOpacity: this.props.activeOpacity,
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ your own styles to your child elements as you see fit. Multiple children are all
| ``onLongPress`` | ``func`` | Function to execute when the ``onLongPress`` event is triggered. |
| ``textStyle`` | ``TextStylePropTypes`` | The StyleSheet to apply to the inner button text. |
| ``disabledStyle`` | ``TextStylePropTypes`` | The StyleSheet to apply when disabled. |
| ``dismissKeyboard`` | ``bool`` | Dismiss keyboard onPressIn |
| ``children`` | ``string``, ``number``, ``React.Element``,or ``array`` | The child nodes to render inside the button. If child is ``string`` or ``number``, it will be rendered inside of a ``<Text>`` element with ``textStyle`` applied if present. Multiple children are allowed (``array``).|
| ``isLoading`` | ``bool`` | Renders an inactive state dimmed button with a spinner if ``true``. |
| ``isDisabled`` | ``bool`` | Renders an inactive state dimmed button if ``true``. |
Expand Down