Skip to content

Instantly share code, notes, and snippets.

@manojsinghnegiwd
Created March 11, 2017 17:42
Show Gist options
  • Save manojsinghnegiwd/0afc3b182983c2bd4b627fdd8355330e to your computer and use it in GitHub Desktop.
Save manojsinghnegiwd/0afc3b182983c2bd4b627fdd8355330e to your computer and use it in GitHub Desktop.
Creating A React Native Android Button Component.
export default class Button extends Component {
render () {
let {onPress, isRipple, rippleColor, children, style} = this.props;
return (
<View>
<TouchableNativeFeedback
onPress={onPress}
background={isRipple ? TouchableNativeFeedback.Ripple(rippleColor || "#000000") : null}>
<View style={style}>
{children}
</View>
</TouchableNativeFeedback>
</View>
)
}
}
import Button from './Button
import React, { Component } from 'react';
import {
View,
TouchableNativeFeedback
} from 'react-native';
render () {
return (
<View>
<Button isRipple onPress={() => alert(‘This works great’) } style={{ width: 100, height: 50, justifyContent: "center",alignItems: "center"}} rippleColor="red">
<Text> Button </Text>
</Button>
</View>
)
}
let {onPress, isRipple, rippleColor, children, style} = this.props;
export default class Button extends Component {
render () {
return (
<View>
</View>
)
}
}
touch Button.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment