4umo / react-native-stars Goto Github PK
View Code? Open in Web Editor NEWa versatile react native star review component with half star compatibility and custom images, star sizes, star count, star spacing, and value display.
License: MIT License
a versatile react native star review component with half star compatibility and custom images, star sizes, star count, star spacing, and value display.
License: MIT License
Image cannot show image in iOS 14, but can show location, like:
<Stars
default={0}
opacity={true}
count={5}
starSize={32}
update={val => {
this.starState(val);
this.setState({ starVal: val });
}}
spacing={8}
disabled={false}
half={false}
fullStar={require('App/Assets/Images/Place/starOn.png')}
emptyStar={require('App/Assets/Images/Place/starOff.png')}
halfStar={require('App/Assets/Images/Place/starHalf.png')}
/>
Environment:
Xcode Version 12.0 (12A7209)
Simulator: IPhone 11 - 14.0
"react-native": "0.62.2"
Hello,
I want to use this library in replacement to SVG rendering on my app (due to performance issue when rendering many SVGs). I have found that partial values are not displayed correctly.
This is the display I would get for a 4.4 / 5 rating :
And here is what the component looks like :
I guess it has to do with react-native version or some styling issue, I will try to debug it.
Here are my system informations from react-native info
System:
OS: macOS 10.15.3
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 2.66 GB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 11.14.0 - /var/folders/6f/g_r7mj015c55ch_5vx9r0rkc0000gn/T/yarn--1584108282406-0.2228863223045563/node
Yarn: 1.15.2 - /var/folders/6f/g_r7mj015c55ch_5vx9r0rkc0000gn/T/yarn--1584108282406-0.2228863223045563/yarn
npm: 6.12.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 23.0.1, 25.0.0, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3
System Images: android-27 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 11.0/11A419c - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.60.6 => 0.60.6
npmGlobalPackages:
react-native-cli: 2.0.1
✨ Done in 183.79s.
Hi there
I need to call api when the star value gets changes
So is there any event method which called when star value gets changes Like onChange op selectedStar etc
Please let me know
Thanks
Hello,
I have the current code:
<View style={{ alignItems:'center' }} > <Stars value={1} spacing={8} count={5} starSize={40} backingColor='transparent' fullStar={require('../../images/fullstar.png')} emptyStar={require('../../images/emptystar.png')} halfStar={require('../../images/halfstar.png')} /> </View> </View>
but when I have a value of 1, it shows 2 stars. Same happens for any values put in
please merge my commit to use to resolve Breaking Change on RN 0.50.0 onwards
I make use of this library and found that I can't make 0 rating after setting 1 or half of rating.
And one more thing is there any way to set default rating as 1 later user won't able to make 0.5 rating.
Can anyone please help me out?
rating
mode only handles integer and 0.5 value increments properly. This is the code that does the evaluation:
https://github.com/Extrct/react-native-stars/blob/master/index.js#L162
If the rating prop passed in is 4.5, it shows 4.5 stars as expected. However if the rating prop is 4.7, it shows 4 stars due to the logic on that line.
Hello,
I am using the custom version for the star rating and it's not letting me change the size even though I have set it to starSize={50}
Here's what I have set to:
<StarRating
default={2.5}
count={5}
half={true}
starSize={50}
fullStar={<Icon name={'star'} style={[styles.myStarStyle]}/>}
emptyStar={<Icon name={'star-outline'} style={[styles.myStarStyle, styles.myEmptyStarStyle]}/>}
halfStar={<Icon name={'star-half'} style={[styles.myStarStyle]}/>}
/>
It would be great if this library supported expo vector icons in addition to images.
import MaterialIcons from '@expo/vector-icons';
<Stars
fullStar={<MaterialIcons name='star' />}
/>
Hey there,
I calculate the number of starts by adding 2 values and splitting it, and i log the value, it is correct, but when i pass it to the star's value property and display it it shows always 1 more star.
for example (1+5)/2 =3 right but it displays 4 stars
here is my star component:
<Stars
value={props.data.rating}
half={props.half}
spacing={8}
count={5}
starSize={50}
backingColor="transparent"
fullStar={require("./../icons/filled-heart.png")}
emptyStar={require("./../icons/empty-heart.png")}
halfStar={require("./../icons/half-heart.png")}
/>
also it does the same if i just put in a number for value
Hey there I made a component to display rating but it allows me to edit the rating, if I click on any of the icons
my code:
<View style={styles.container}>
<Text style={styles.border}>★・・・・・・★・・・・・・★・・・・・・★</Text>
<Text style={styles.text}>{props.data.name}</Text>
<Stars
half={props.half}
rating= {props.data.rating}
spacing={8}
count={5}
starSize={50}
backingColor='transparent'
fullStar={require('./../icons/filled-heart.png')}
emptyStar={require('./../icons/empty-heart.png')}
halfStar={require('./../icons/half-heart.png')}
/>
</View>
Why is that the case?
设置default 和display 时,没有显示相应的星级,并没有报错,请问是什么情况?
Hi, just tried using the stars component to display some stars and the half star is working for the selection but not display. Any help, suggestion on whats going on?
<Stars
value={4.5}
spacing={0.8}
half={true}
count={5}
starSize={20}
backingColor="cornsilk"
halfStar={require('../../assets/icons/star_half.png')}
fullStar={require('../../assets/icons/star_filled.png')}
emptyStar={require('../../assets/icons/star_empty.png')}/>
When the value of props display is zero, the javascript code considers It as false, so It gets edit mode
<Stars
display={0}
...
/>
I am following the documentation to display partial rating, but display props throw errors when i pass the rating state into it.
The error message is as follows:
Json.stringify cannot serialize cyclic structure.
Any solution to solve this issue?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.