0.3.0 • Published 7 years ago

react-native-collidable v0.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

react-native-collidable

Collidable Components in react native

IntroScreen Example

Bouncing Football Example

Note: Only tested with iOS, not recommended to be used until version 1.0 is released.

Find a working example on Expo: https://exp.host/@kiok46/collidable

Properties

Note: Other properties will be passed down to underlying component.

PropDescriptionDefault
disablePanResponderWhether to use PanResponder or not.false
containerDimensionFor how long the animation will run (milliseconds).[0, Screen Width, Screen Height, 0]
collidableOffSetHeightUse Container Height - Component Height to create a illusion of contact with the edges.75
collidableOffSetWidthUse Container Width - Component Width to create a illusion of contact with the edges.75
initialVelocityXInitial Velocity of Component in x-direction0
initialVelocityYInitial Velocity of Component in y-direction0
velocityMinXMinimum velocity in x-direction required to to stop the Component0.06
velocityMinYMinimum velocity in y-direction required to to stop the Component0.06
velocityMaxXMax velocity in x-direction once reached use ononReachingMaxVelocity callback30
velocityMaxYMax velocity in y-direction once reached use ononReachingMaxVelocity callback30
verticalGravityEnabledGravity effect in vertical directionfalse
horizontalGravityEnabledGravity effect in horizontal directionfalse
verticalGravityGravity effect value in vertical direction..2
horizontalGravityGravity effect value in horizontal direction..2
enableImpactForceImpace force is used to reduce the speed of colliding Component after impactfalse
verticalImpactForceImpact force for reducing vertical speed0
horizontalImpactForceImpact force for reducing horizontal speed0
collidableStyleStyle for the Animated ComponentNone
onReachingMaxVelocityCalled once the Component's velocity is >= velocityMaxX or velocityMaxY() => {}

Want to contribute or need to see some improvements?

I would love that, please create an issue or send a PR.