@@ -4,6 +4,7 @@ import { Rating } from 'react-native-rating-element';
44
55const App = ( ) => {
66 const [ rating , setRating ] = useState ( 0 ) ;
7+ const [ imageRating , setImageRating ] = useState ( 0 ) ;
78
89 return (
910 < View style = { styles . body } >
@@ -27,7 +28,7 @@ const App = () => {
2728
2829 < View style = { styles . card } >
2930 < Text style = { { fontSize : 16 } } >
30- Readonly Rating (3/5, direction="column")
31+ Interactive Rating (3/5, direction="column-reverse ")
3132 </ Text >
3233 < Rating
3334 rated = { rating }
@@ -36,11 +37,29 @@ const App = () => {
3637 ratingBackgroundColor = "#d4d4d4"
3738 size = { 32 }
3839 icon = "add-circle"
39- direction = "column"
40+ direction = "column-reverse "
4041 onIconTap = { pos => setRating ( pos ) }
4142 />
4243 < Text accessibilityLiveRegion = "polite" accessibilityLabel = { `Rating selected ${ rating } out of 5` } > { rating } /5 (200)</ Text >
4344 </ View >
45+
46+ < View style = { styles . card } >
47+ < Text style = { { fontSize : 16 } } >
48+ Custom Images Rating
49+ </ Text >
50+ < Rating
51+ rated = { imageRating }
52+ totalCount = { 5 }
53+ size = { 48 }
54+ direction = "row"
55+ type = "custom"
56+ onIconTap = { pos => setImageRating ( pos ) }
57+ selectedIconImage = { require ( './assets/filled.png' ) }
58+ emptyIconImage = { require ( './assets/empty.png' ) }
59+ />
60+ < Text accessibilityLiveRegion = "polite" accessibilityLabel = { `Rating selected ${ imageRating } out of 5` } > { imageRating } /5 (100)</ Text >
61+ </ View >
62+
4463 </ View >
4564 ) ;
4665} ;
@@ -53,6 +72,9 @@ const styles = StyleSheet.create({
5372 justifyContent : 'center' ,
5473 } ,
5574 card : {
75+ padding : 10 ,
76+ borderWidth : 1 ,
77+ borderColor : '#eee' ,
5678 marginBottom : 20 ,
5779 } ,
5880} ) ;
0 commit comments