Skip to content

Commit

Permalink
fix(button): Add TouchableOpacity props support
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Kozel committed Dec 6, 2017
1 parent 962c6f1 commit d29f627
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/ExplorerApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"update-lib": "rm -r node_modules/react-native-ui-kitten && npm install && ./node_modules/react-native/scripts/packager.sh ."
"update-lib": "rm -r node_modules/react-native-ui-kitten && npm install"
},
"dependencies": {
"prop-types": "^15.5.10",
Expand Down
16 changes: 3 additions & 13 deletions src/components/button/rkButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@ import {RkComponent} from '../rkComponent'
* `circle`, `small`, `medium`, `large`, `xlarge`, `clear`, `stretch`
* @property {style} style - Style for button container
* @property {style} contentStyle - Style for each button's children
* @property {function} onPress - Called when the touch is released, but not if cancelled.
* @property {function} onPressIn - Same as `TouchableWithoutFeedback.onPressIn`
* @property {function} onPressOut - Same as `TouchableWithoutFeedback.onPressOut`
* @property {function} onLongPress - Called when the touch is released and is longer than usual press, but not if cancelled
* @property {TouchableOpacity.props} props - All `TouchableOpacity` props also applied to `RkButton`
*/

export class RkButton extends RkComponent {
Expand Down Expand Up @@ -164,17 +161,10 @@ export class RkButton extends RkComponent {
}

render() {
let a = this.context;
let {container, content} = super.defineStyles();
let touchableProps = {
onPress: this.props.onPress,
onPressIn: this.props.onPressIn,
onPressOut: this.props.onPressOut,
onLongPress: this.props.onLongPress
};

let {style, ...touchableProps} = this.props;
return (
<TouchableOpacity style={[container, this.props.style]} {...touchableProps}>
<TouchableOpacity style={[container, style]} {...touchableProps}>
{this.props.children && this._renderChildren(content)}
</TouchableOpacity>
);
Expand Down

0 comments on commit d29f627

Please sign in to comment.