File tree Expand file tree Collapse file tree 4 files changed +19
-18
lines changed Expand file tree Collapse file tree 4 files changed +19
-18
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,12 @@ const App = () => {
2424 }
2525 text = "Custom Icon Example"
2626 />
27- < BouncyCheckbox fontFamily = "JosefinSans-Regular" />
27+ < BouncyCheckbox
28+ fontFamily = "JosefinSans-Regular"
29+ onPress = { checked => {
30+ alert ( checked ) ;
31+ } }
32+ />
2833 < BouncyCheckbox
2934 text = "Get groceries"
3035 fontFamily = "JosefinSans-Regular"
Original file line number Diff line number Diff line change 1515 "react" : " 16.12.0" ,
1616 "react-native" : " 0.61.5" ,
1717 "react-native-bottom-search-bar" : " 0.1.1" ,
18- "react-native-bouncy-checkbox" : " 0.0.3 " ,
18+ "react-native-bouncy-checkbox" : " 0.0.5 " ,
1919 "react-native-dynamic-vector-icons" : " ^0.2.1" ,
2020 "react-native-iphone-x-helper" : " ^1.2.1" ,
2121 "react-native-vector-icons" : " ^6.6.0"
Original file line number Diff line number Diff line change @@ -17,22 +17,18 @@ class BouncyCheckbox extends Component {
1717 this . setState ( { checked : this . props . isChecked } ) ;
1818 }
1919
20- setChecked = ( ) => {
21- const { checked } = this . state ;
22- this . setState ( { checked : ! checked } ) ;
23- } ;
24-
2520 spring = ( ) => {
26- this . setChecked ( ) ;
27- const { springValue } = this . state ;
28- const { onPress } = this . props ;
29- springValue . setValue ( 0.7 ) ;
30- Animated . spring ( springValue , {
31- toValue : 1 ,
32- friction : 3
33- } ) . start ( ) ;
34- // Outside of the onPress function
35- if ( onPress ) onPress ( this . state . checked ) ;
21+ const { checked, springValue } = this . state ;
22+ this . setState ( { checked : ! checked } , ( ) => {
23+ springValue . setValue ( 0.7 ) ;
24+ Animated . spring ( springValue , {
25+ toValue : 1 ,
26+ friction : 3
27+ } ) . start ( ) ;
28+ // Outside of the onPress function
29+ const { onPress } = this . props ;
30+ if ( onPress ) onPress ( this . state . checked ) ;
31+ } ) ;
3632 } ;
3733
3834 renderCheckIcon = ( ) => {
Original file line number Diff line number Diff line change 11{
22 "name" : " react-native-bouncy-checkbox" ,
3- "version" : " 0.0.4 " ,
3+ "version" : " 0.0.5 " ,
44 "description" : " Fully customizable animated bouncy checkbox for React Native" ,
55 "keywords" : [
66 " bouncy" ,
You can’t perform that action at this time.
0 commit comments