# react-native-leaderboard

> Instant leaderboard for react native

Latest version **1.0.6** (published 2019-08-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-native-leaderboard
pnpm add react-native-leaderboard
yarn add react-native-leaderboard
bun add react-native-leaderboard
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2019-08-07 |
| First published | 2017-09-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 448.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 62 |
| Author | mrjoeroddy@gmail.com |
| Maintainers | joeroddy |
| Keywords | react, native, leaderboard, leaders, simple |

## Links

- npm: https://www.npmjs.com/package/react-native-leaderboard
- Repository: https://github.com/JoeRoddy/react-native-leaderboard
- Homepage: https://github.com/JoeRoddy/react-native-leaderboard#readme
- Issues: https://github.com/JoeRoddy/react-native-leaderboard/issues
- npm.io page: https://npm.io/package/react-native-leaderboard

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.6.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2019-08-07
- 1.0.5 — 2018-05-17
- 1.0.4 — 2017-11-20
- 1.0.3 — 2017-09-01
- 1.0.2 — 2017-09-01
- 1.0.1 — 2017-09-01
- 1.0.0 — 2017-09-01

## README

# react-native-leaderboard
Simple and configurable leaderboard component for react native

![](./example.gif)

### Up and Running

```shell
$ npm install --save react-native-leaderboard
```

### Simple Example

```javascript
//...
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 |

---
_Source: https://npm.io/package/react-native-leaderboard · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
