1.0.6 • Published 5 years ago

react-native-leaderboard v1.0.6

Weekly downloads
41
License
ISC
Repository
github
Last release
5 years ago

react-native-leaderboard

Simple and configurable leaderboard component for react native

npm.io

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

PropTypeRequiredDescription
dataarray or objectyesObject array or object of objects
sortBystringyesData property that should be sorted and displayed
labelBystringyesData property that should be displayed to identify user
iconstringnoData property that stores the avatar's URL
onRowPressfunctionnoCalled when a row is clicked. Arguments: item, index
sortfunctionnoOverride the default sort behavior. Arguments: data
renderItemfunctionnoOverride the default row. Arguments: item, index
containerStyleobjectnoStyle for the outer container (RN.View)
rankStyleobjectnoStyle for the displayed rank (RN.Text)
labelStyleobjectnoStyle for the displayed name (RN.Text)
scoreStyleobjectnoStyle for displayed score (RN.Text)
avatarStyleobjectnoStyle for user images (RN.Image)
oddRowColorstringnoBackground color for odd rows
evenRowColorstringnoBackground color for even rows
1.0.6

5 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago