Git Product home page Git Product logo

react-native-star-rating's People

Contributors

agontuk avatar cajoy avatar dejakob avatar djchie avatar fredericruaudel avatar iroachie avatar jamesqo avatar lukashlavacka avatar markthom-as avatar polguixe avatar proyoyo avatar rodrigopk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-star-rating's Issues

project not starting after installation

i simply run this command npm install react-native-star-rating --save and after that i starts my project and it shows this error.
Error starting packager: TypeError: Invalid Version: undefined

Prop for margin or style of individual stars

It should be available the option to set the style on individual stars. In my case, I would like to add horizontal margin. Any active contributors open to this? Or I might be able to open a PR.

Toggle visibility

Shouldn't there be a prop that toggles the component's visibility?

Created in android

But it's wrong!
qq20161218-220001

import React, {Component} from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
} from 'react-native';

import StarRating from 'react-native-star-rating';

export default class StarRaingDemo extends Component {
    constructor(props) {
        super(props);
        this.state = {
            starCount: 3.5
        };
    }

    onStarRatingPress(rating) {
        this.setState({
            starCount: rating
        });
    }

    render() {
        return (
            <View>
                <StarRating disabled={false}
                            maxStars={5}
                            rating={this.state.starCount}
                            starColor={'red'}
                            emptyStar={'target-two'}
                            fullStar={'thumbnails'}
                            halfStar={'torso'}
                            iconSet={'Foundation'}
                            selectedStar={(rating) => this.onStarRatingPress(rating)}/>
            </View>
        ); 
    }
}
AppRegistry.registerComponent('BackUp', () => StarRaingDemo);

accessibilityLabel Not available for automation testing

Hi Team,
I am having an issue when I am integrating test automation for the rating bar star selection. the issue is this rating bar not contain accessibility for the star index. So is there any solution to this?
Thank you.

Excuse me.

打扰一下,我可以滑动打星星吗?还有现在只能显示半颗星星,但是不能点击出来半颗星星.
Excuse me, can I slide the stars? And now I can show only half a star, but not half a star

Use our own images

I want use my resources icon.

It is posible?

Example: fullStar={require('../../../Resources/star.png')}

License

Hi
I could not find any license information on the repository. Is there a reason? Can you please add one?

Thanks!

Issues running this package locally with nom link.

I've forked this package and I've made some modifications.

I am trying to use npm link to use the package with one of my projects. However, I am not managing to make it work.

Has anybody found a way of doing it?

It does work with npm install $PATH. npm link is more convenient.

Exception on transform inside renderIcon()

config:

"react-native": "0.47.2"
"react-native-star-rating": "^1.0.8"
Android 7.1.0 real device

my code

<StarRating
  disabled={false}
  maxStars={5}
  rating={this.state.rating}
  selectedStar={rating => this.setState({ rating })}
  starStyle={{paddingHorizontal: 6}}
  starSize={50}
  starColor={colors.active}
  emptyStarColor={colors.active}
  emptyStar="star-border"
  iconSet="MaterialIcons"
/>

Error stack:

TypeError: Cannot create property 'transform' on number '351'
    at update (index.js:157)
    at StarButton.renderIcon (star-button.js:76)
    at StarButton.render (star-button.js:131)
    at ReactNativeStack-dev.js:1863
    at measureLifeCyclePerf (ReactNativeStack-dev.js:1610)
    at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (ReactNativeStack-dev.js:1862)
    at ReactCompositeComponentWrapper._renderValidatedComponent (ReactNativeStack-dev.js:1872)
    at ReactCompositeComponentWrapper.performInitialMount (ReactNativeStack-dev.js:1696)
    at ReactCompositeComponentWrapper.mountComponent (ReactNativeStack-dev.js:1655)
    at Object.mountComponent (ReactNativeStack-dev.js:1327)

UPDATE
@djchie If I remove starStyle everything works, so I think the code expects a style structured in a particular way.

StarRating.js not parsing

Hello, for some reason StarRating.js is not parsing during compile in a standard React projet. Any ideas?
Compiler message:
/node_modules/react-native-star-rating/StarRating.js
Module parse failed: Unexpected token (121:8)
You may need an appropriate loader to handle this file type.
|
| const starButtonElement = (
| <StarButton
| activeOpacity={0.20}
| buttonStyle={buttonStyle}
@ ./node_modules/react-native-star-rating/index.js 2:0-38 4:15-25
@ ./components/Stars.js
@ ./app.js
@ multi (webpack)-dev-server/client?http://localhost:8080 ./app

Naming collision stops Building of the Project

Failed to build DependencyGraph: Naming collision detected: /Users/hms-mac/research/react-native/maps/MapViewExample/node_modules/react-native-star-rating/node_modules/react-native/Libraries/vendor/react/browser/eventPlugins/TouchHistoryMath.js collides with /Users/hms-mac/research/react-native/maps/MapViewExample/node_modules/react-native/Libraries/vendor/react/browser/eventPlugins/TouchHistoryMath.js
Error: Naming collision detected: /Users/hms-mac/research/react-native/maps/MapViewExample/node_modules/react-native-star-rating/node_modules/react-native/Libraries/vendor/react/browser/eventPlugins/TouchHistoryMath.js collides with /Users/hms-mac/research/react-native/maps/MapViewExample/node_modules/react-native/Libraries/vendor/react/browser/eventPlugins/TouchHistoryMath.js
    at HasteMap._updateHasteMap (HasteMap.js:132:13)
    at HasteMap.js:103:28
    at tryCallOne (/Users/hms-mac/research/react-native/maps/MapViewExample/node_modules/promise/lib/core.js:37:12)
    at /Users/hms-mac/research/react-native/maps/MapViewExample/node_modules/promise/lib/core.js:123:15
    at flush (/Users/hms-mac/research/react-native/maps/MapViewExample/node_modules/asap/raw.js:50:29)
    at doNTCallback0 (node.js:428:9)
    at process._tickCallback (node.js:357:13)

I have React-Native 0.20.0 installed.

Use icon sets exported from IcoMoon

The react-native-vector-icons has a method createIconSetFromIcoMoon, which creates an icon sets using an IcoMoon json configuration file.
I would like to propose that the StarRating and StarButton components had an optional prop to receive a IcoMoon configuration json, so that the user is able to use his own icon set if needed.
Below follows an example to illustrate how we could use a prop for loading a custom icon set from a config json:

// star-button.js
import { createIconSetFromIcoMoon } from 'react-native-vector-icons';
.
.
.
  iconSetFromProps() {
    const {
      iconSet,
      icoMoonJson
    } = this.props;
    if (icoMoonJson) {
      return createIconSetFromIcoMoon(icoMoonJson);
    } else {
      return iconSets[iconSet];
    }
  }

Flow error: Duplicate module provider

React: 15.4.2
React Native: 0.41.0
Flow: 0.37.4

Error:

generateIconSetFromCss. Duplicate module provider
current provider. See: node_modules/react-native-star-rating/node_modules/react-native-vector-icons/lib/generate-icon-set-from-css.js:0

Removing @providesModule generateIconSetFromCss gets rid of the error. I believe this is now defunct in any case.

Static rendering

I'm looking to render this component as a static component over another component. When I do this, the parent component loses touch-ability when touches are happening over the stars.

I'm wondering if we can bubble the touch events up when we do not need to use the stars as an input :) Thanks!

Invalid props.starStyle key `tintColor` supplied to `StarButton`

I used my icon pass as image (require(...)) and i paint with tintColor.
First i try use emptyStartColor/fullStartColor but it does't have effect.
Then i pass tintColor in starStyle object, it is work perfect, but i got warning

Warning: Failed prop type: Invalid props.starStyle key `tintColor` supplied to `StarButton`.

I think probably lib use not current PropsType for Image

Different colors for each star

Hello !
Is it possible to set a different color for each star?
Like, the first is red, second orange, third yellow, fourth pale green, fifth green ...
Thank you !

Star icon not displaying

**Star icon not displaying instead blank screen gets displayed".
Example Code as follows:

import React from 'react-native';
var {
AppRegistry,
Component,
View,
} = React;

import StarRating from 'react-native-star-rating';

class CustomStarExample extends Component {

constructor(props) {
super(props);
this.state = {
starCount: 2.5
};
}

onStarRatingPress(rating) {
this.setState({
starCount: rating
});
}

render() {
return (
<StarRating
disabled={false}
emptyStar={'android-star-outline'}
fullStar={'android-star'}
halfStar={'android-star-half'}
iconSet={'Ionicons'}
maxStars={5}
rating={this.state.starCount}
selectedStar={(rating) => this.onStarRatingPress(rating)}
starColor={'yellow'}
/>
);
}
}
AppRegistry.registerComponent('AbcProject', () => CustomStarExample);

Naming collision

When I installed the lib, I had this error in my packager:

Error building DependencyGraph:
 Error: Naming collision detected: /home/cloud/React-native/ReactProject/node_modules/react-native-star-rating/node_modules/react-native/packager/react-packager/src/DependencyResolver/polyfills/polyfills.js collides with /home/cloud/React-native/ReactProject/node_modules/react-native/packager/react-packager/src/Resolver/polyfills/polyfills.js
    at HasteMap._updateHasteMap (HasteMap.js:123:13)
    at HasteMap.js:94:28
    at tryCallOne (/home/cloud/React-native/ReactProject/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
    at /home/cloud/React-native/ReactProject/node_modules/react-native/node_modules/promise/lib/core.js:123:15
    at flush (/home/cloud/React-native/ReactProject/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
    at doNTCallback0 (node.js:419:9)
    at process._tickCallback (node.js:348:13)

I tried to delete the react-native folder in the lib's node_modules but it didn't work.

I'm using rn 0.17.

Kind regards,

One star missing no matter which stars I use.

No matter how many stars and different icons I try tho draw from the react-native-vector-icons package, I always end up missing one of the middle stars.

Here the bad star is highlighted in the debugger:
debugger preview

This is the code:

			import Stars from 'react-native-stars';
			import Icon from 'react-native-vector-icons/FontAwesome';
				<View style={styles.header}>
                    <View style={{alignItems:'center'}}>
                        <Stars
                            display={3}
                            spacing={8}
                            count={6}
                            backingColor='white'
                            fullStar={<Icon name={'star'} size={30}/>}
                            emptyStar={<Icon name={'star-half-empty'} size={30} />}
                            halfStar={<Icon name={'star-o'} size={30} />}
                        />
                    </View>
                </View>

and this is how it looks like:
broken star

Rating not refresh on property change

So I have list view and when I refresh list view it caches rating for the list item.

And just sets new props.

The script is uses state for rendering and doesn't watch for props changes what causes the same rating as before.

Support for different Icons

It would be amazing to have the posiblitity to set different icons if the if developer wants to do so, at least up to five. Something like this:

import StarRating from 'react-native-star-rating';

class DifferentIcons extends Component {

  constructor(props) {
    super(props);
    this.state = {
      starCount: 5
    };
  }

  onStarRatingPress(rating) {
    this.setState({
      starCount: rating
    });
  }

  render() {
    return (
      <StarRating
        disabled={false}
        maxStars={5}
		starOne={'$'}
		starTwo={'$$'}
		starThree={'$$$'}
		starFour={'$$$$'}
		starFive={'$$$$$'}
        rating={this.state.starCount}
        selectedStar={(rating) => this.onStarRatingPress(rating)}
      />
    );
  }
}

export default DifferentIcons;

Running locally with npm link

I've forked this package and I've made some modifications.

I am trying to use npm link to use the package with one of my projects. However, I am not managing to make it work.

Has anybody found a way of doing it?

star icon show ?

the star icon show ? ? ? ? ,

001

this is my code

<StarRating
                            disabled={false}
                            emptyStar={'android-star-outline'}
                            fullStar={'android-star'}
                            halfStar={'android-star-half'}
                            iconSet={'Ionicons'}
                            maxStars={3}
                            rating={this.state.starCount}
                            selectedStar={(rating) => this.onStarRatingPress(rating)}
                            starColor={'red'}
                            starSize={18}
                        />

Half Star Rating

I see in the documentation that it is possible to display a half-star rating (i.e. 3.5/5), however I was wondering if there is a way to rate with half-star, and if so, how do you make this possible?

We've implemented the component and it's working nicely, but we haven't been able to rate with a half-star rating so far. Thank you very much for any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.