11import React , { Component } from 'react'
22import PropTypes from 'prop-types'
3- import { Animated , Easing , Text , TouchableOpacity , View , StyleSheet } from 'react-native'
3+ import { Animated , Easing , Text , TouchableOpacity , View } from 'react-native'
44import Icon from 'react-native-dynamic-vector-icons'
5+ import styles , { _iconContainer , _textStyle } from "./BouncyCheckbox.style"
56
67class BouncyCheckbox extends Component {
78 constructor ( props ) {
@@ -54,16 +55,7 @@ class BouncyCheckbox extends Component {
5455 < Animated . View
5556 style = { [
5657 { transform : [ { scale : springValue } ] } ,
57- {
58- width : size ,
59- height : size ,
60- borderWidth,
61- borderRadius,
62- alignItems : 'center' ,
63- justifyContent : 'center' ,
64- borderColor,
65- backgroundColor : checked ? fillColor : unfillColor
66- } ,
58+ _iconContainer ( size , borderWidth , borderRadius , borderColor , checked , fillColor , unfillColor ) ,
6759 iconStyle
6860 ] }
6961 >
@@ -80,32 +72,22 @@ class BouncyCheckbox extends Component {
8072 { this . renderCheckIcon ( ) }
8173 < View style = { styles . textContainer } >
8274 < Text
83- style = { [
84- {
85- fontSize,
86- fontFamily,
75+ style = { [ _textStyle (
76+ this . state . checked ,
8777 color ,
88- textDecorationLine : ! textDecoration && checked ? 'line-through' : 'none'
89- } ,
90- textStyle
91- ] }
92- >
78+ fontFamily ,
79+ fontSize ,
80+ textDecoration ,
81+ ) , textStyle ] } >
9382 { text }
9483 </ Text >
84+
9585 </ View >
9686 </ TouchableOpacity >
9787 )
9888 }
9989}
10090
101- const styles = StyleSheet . create ( {
102- container : {
103- margin : 8 ,
104- alignItems : 'center' ,
105- flexDirection : 'row'
106- } ,
107- textContainer : { marginLeft : 16 }
108- } )
10991
11092BouncyCheckbox . propTypes = {
11193 borderWidth : PropTypes . number ,
0 commit comments