Giter VIP home page Giter VIP logo

react-native-leaderboard's Introduction

react-native-leaderboard

Simple and configurable leaderboard component for react native

Up and Running

$ npm install --save react-native-leaderboard

Simple Example

//...
import Leaderboard from 'react-native-leaderboard';
//...
this.state = {
    data: [
        {userName: 'Joe', highScore: 52},
        {userName: 'Jenny', highScore: 120},
        //...
    ] //can also be an object of objects!: data: {a:{}, b:{}}
}

render() {
  return (
      <Leaderboard 
        data={this.state.data} 
        sortBy='highScore' 
        labelBy='userName'/>)
}

Props

Prop Type Required Description
data array or object yes Object array or object of objects
sortBy string yes Data property that should be sorted and displayed
labelBy string yes Data property that should be displayed to identify user
icon string no Data property that stores the avatar's URL
onRowPress function no Called when a row is clicked. Arguments: item, index
sort function no Override the default sort behavior. Arguments: data
renderItem function no Override the default row. Arguments: item, index
containerStyle object no Style for the outer container (RN.View)
rankStyle object no Style for the displayed rank (RN.Text)
labelStyle object no Style for the displayed name (RN.Text)
scoreStyle object no Style for displayed score (RN.Text)
avatarStyle object no Style for user images (RN.Image)
oddRowColor string no Background color for odd rows
evenRowColor string no Background color for even rows

react-native-leaderboard's People

Contributors

joeroddy avatar

Watchers

James Cloos avatar

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.