react-native-animated-button
v0.0.6
Published
AnimatedButton is a pure JavaScript Component which can change the style of Button from unactive to active by animations. Users could set the normal style and active style to get what effect they wants. Also the Text and Source could change by touch event
Downloads
11
Maintainers
Readme
AnimatedButton
AnimatedButton is a pure JavaScript Component which can change the style of Button from unactive to active by animations. Users could set the normal style and active style to get what effect they wants. Also the Text and Source could change by touch event.
Demo
Installation
npm install react-native-animated-button -save
Documentaion
Usage
import Button from 'react-native-animated-button';
class Demo extends Component {
render() {
return (
<Button/>
)
}
}
Examples
<Button
style={{marginTop:10,alignSelf:'center', height: 55,width:80, backgroundColor: 'white', borderWidth: 1 / PixelRatio.get(), borderColor: '#0033FF', borderRadius: 5}}
imageStyle={{height:50,width:50}}
activeStyle={{marginTop:10,alignSelf:'center',height: 55,width:100, backgroundColor: 'white', borderWidth: 1 / PixelRatio.get(), borderColor: '#0033FF', borderRadius: 5}}
source={require('./jpg/head.jpg')}
text="左⬅️️"
animated={true}
type="iconLeft"
onLongPress={() => {
console.log('onLongPress...');
}}
onPress={() => {
console.log('onPress...');
}}
onPressIn={() => {
console.log('onPressIn...');
}}
onPressOut={() => {
console.log('onPressOut...');
}}
>
Props
animated
(Boolean)false
- animated or not for Buttonanimations
(Object) animations for the style of Button from unactive to activeonPressIn
(Function) callback when pressinonPressOut
(Function) callback when pressouttype
(Oneof:(['iconLeft', 'iconRight', 'iconTop', 'iconBottom']))iconBottom
- the relative position for Image and Textstyle
(Style) - style of the Button which is unactiveactiveStyle
(Style) - style of the Text which is activetext
(String) - text in ButtonactiveText
(String) - text when Button is activefontStyle
(Style) - style of the Text which is unactiveactiveFontStyle
(Style) - style of the Text which is activesource
(Source) - source of Image which is unactiveactiveSource
(Source) - source of Image which is activeimageStyle
(Style) - style of the Image which is unactiveactiveImageStyle
(Style) - style of the Image which is unactive