
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-native-rewards
Advanced tools
This package lets you easily add microinteractions to your app and reward users with the rain of confettis or flying emoji in seconds.
Library is strongly inspired by react-rewards created by The Develobear!
$ npm install react-native-rewards --save
$ yarn add react-native-root-view-background
Library is 100% javascript so, there is no need to do native linking
using props:
import RewardsComponent from 'react-native-rewards';
import React, { Component, createRef } from 'react';
class App extends Component {
state={
animationState: 'rest',
}
render() {
const { animationState } = this.state;
return (
<RewardsComponent
animationType="confetti"
state={animationState}
onRest={() => this.setState({ animationState: 'rest' })}
>
<TouchableOpacity
onPress={() => this.setState({ animationState: 'reward' })}
style={styles.buttonProps}
>
<Text style={styles.buttonText}>+</Text>
</TouchableOpacity>
</RewardsComponent>
)
}
}
using ref:
import RewardsComponent from 'react-native-rewards';
import React, { Component, createRef } from 'react';
class App extends Component {
constructor(props) {
super(props);
this.rewardsComponent = createRef();
}
render() {
return (
<RewardsComponent
ref={this.rewardsComponent}
animationType="emoji"
>
<TouchableOpacity
onPress={() => this.rewardsComponent.current.rewardMe()}
style={styles.button}
>
<Image source={require('./assets/cup.png')}
style={styles.icon}/>
</TouchableOpacity>
</RewardsComponent>
)
}
}
| name | type | description | required | default |
|---|---|---|---|---|
children | React Element | content to animate e.g. Button | YES | |
initialSpeed | Number/Float | initial speed of partices | NO | 1 |
spread | Number/Float | Multiplier of distance beetween partices | NO | 1 |
deacceleration | Number/Float | Multiplier how fast partices deaccelerate in firt phase | NO | 1 |
rotationXSpeed | Number/Float | Rotation speed multiplier in X axis | NO | 5 |
rotationZSpeed | Number/Float | Rotation speed multiplier in Z axis | NO | 5 |
particiesCount | Number/Integer | Partices count in reward animation | NO | 20 |
colors | Array | Colors used to generate confetti | NO | Some colors :) |
emoji | Array | Emojis used to generate confetti | NO | ['👍','😊','🎉'] |
animationType | String | Type of animation confetti/emoji | NO | confetti |
state | String | State of animation, changing of this value triggers animation | NO | rest |
onRest | Function | Callback when animation goes to rest state | NO |
You can call this method by using refs of component
rewardMe - Triggers reward animationpunishMe - Triggers punish animationYou need to have facebook watchman installed
cd exampleyarnyarn startyarn run sync in another terminal window (doesn't matter where)If you have any issues, you can clear your watches using watchman watch-del-all and try again.
Feel free to ask me qustion on Twitter @JanRomaniak!
FAQs
This package lets you easily add microinteractions to your app and reward users with the rain of confettis or flying emoji in seconds.
We found that react-native-rewards demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.