Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type definition added #38

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions index.js → index
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default class Ripple extends PureComponent {
rippleCentered: false,
rippleSequential: false,
rippleFades: true,
rippleOverflow: false,
disabled: false,

onRippleAnimation: (animation, callback) => animation.start(callback),
Expand All @@ -40,6 +41,7 @@ export default class Ripple extends PureComponent {
rippleCentered: PropTypes.bool,
rippleSequential: PropTypes.bool,
rippleFades: PropTypes.bool,
rippleOverflow: PropTypes.bool,
disabled: PropTypes.bool,

onRippleAnimation: PropTypes.func,
Expand Down Expand Up @@ -232,6 +234,7 @@ export default class Ripple extends PureComponent {
rippleCentered,
rippleSequential,
rippleFades,
rippleOverflow,

...props
} = this.props;
Expand Down Expand Up @@ -260,6 +263,7 @@ export default class Ripple extends PureComponent {

let containerStyle = {
borderRadius: rippleContainerBorderRadius,
overflow: rippleOverflow ? 'visible' : 'hidden'
};

return (
Expand Down
32 changes: 32 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
declare module 'react-native-material-ripple' {
import React from 'react';
import {
Animated,
ViewProps,
TouchableWithoutFeedbackProps,
ViewStyle,
} from 'react-native';

export type RippleProps = {
rippleColor?: string;
rippleOpacity?: number;
rippleDuration?: number;
rippleSize?: number;
rippleContainerBorderRadius?: number;
rippleCentered?: boolean;
rippleSequential?: boolean;
rippleFades?: boolean;
rippleOverflow?: boolean;
disabled?: boolean;
onRippleAnimation?: (
animation: Animated.CompositeAnimation,
callback: () => void,
) => void;
};

const Ripple: React.ComponentType<RippleProps &
(Animated.AnimatedProps<ViewProps> | ViewStyle) &
TouchableWithoutFeedbackProps>;

export default Ripple;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-material-ripple",
"version": "0.9.1",
"version": "0.9.2",
"license": "BSD-3-Clause",
"author": "Alexander Nazarov <[email protected]>",

Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class Example extends Component {
rippleCentered | Ripple always starts from center | Boolean | false
rippleSequential | Ripple should start in sequence | Boolean | false
rippleFades | Ripple fades out | Boolean | true
rippleOverflow | Ripple can overflow its container | Boolean | false
disabled | Ripple should ignore touches | Boolean | false
onPressIn | Touch moved in or started callback | Function | -
onPressOut | Touch moved out or terminated callback | Function | -
Expand Down