react-native-material-ripple
Version:
Base component for touchable elements
88 lines (68 loc) • 3.33 kB
Markdown
[]: https://img.shields.io/npm/v/react-native-material-ripple.svg?colorB=ff6d00
[]: https://npmjs.com/package/react-native-material-ripple
[]: https://img.shields.io/npm/l/react-native-material-ripple.svg?colorB=448aff
[]: https://raw.githubusercontent.com/n4kz/react-native-material-ripple/master/license.txt
[]: https://img.shields.io/codeclimate/maintainability/n4kz/react-native-material-ripple.svg
[]: https://codeclimate.com/github/n4kz/react-native-material-ripple
[]: https://cloud.githubusercontent.com/assets/2055622/24832328/459afaf0-1cb6-11e7-975d-accedb67a716.gif
[]: https://facebook.github.io/react-native/docs/touchablewithoutfeedback.html
[![npm][npm-badge]][npm-url]
[![license][license-badge]][license-url]
[![codeclimate][codeclimate-badge]][codeclimate-url]
Base component for touchable elements
![example][example-url]
* Easy to use
* Configurable
* Consistent look and feel on iOS and Android
* Can be used as drop-in replacement for [TouchableWithoutFeedback][touchable]
* Pure javascript implementation
* RTL Support
```bash
npm install --save react-native-material-ripple
```
```javascript
import React, { Component } from 'react';
import { Text } from 'react-native';
import Ripple from 'react-native-material-ripple';
class Example extends Component {
render() {
return (
<Ripple>
<Text>touch me</Text>
</Ripple>
);
}
}
```
name | description | type | default
:--------------------------- |:-------------------------------------- | --------:|:------------
rippleColor | Ripple color | String | rgb(0, 0, 0)
rippleOpacity | Ripple opacity | Number | 0.3
rippleDuration | Ripple duration in ms | Number | 400
rippleSize | Ripple size restriction | Number | 0
rippleContainerBorderRadius | Ripple container border radius | Number | 0
rippleCentered | Ripple always starts from center | Boolean | false
rippleSequential | Ripple should start in sequence | Boolean | false
rippleFades | Ripple fades out | Boolean | true
disabled | Ripple should ignore touches | Boolean | false
onPressIn | Touch moved in or started callback | Function | -
onPressOut | Touch moved out or terminated callback | Function | -
onPress | Touch up inside bounds callback | Function | -
onLongPress | Touch delayed after onPressIn callback | Function | -
onRippleAnimation | Animation start callback | Function | -
Other [TouchableWithoutFeedback][touchable] properties will also work
```bash
git clone https://github.com/n4kz/react-native-material-ripple
cd react-native-material-ripple/example
npm install
react-native run-ios
```
BSD License
Copyright 2017-2018 Alexander Nazarov. All rights reserved.