0.1.33 • Published 4 years ago

react-native-circle-list v0.1.33

Weekly downloads
18
License
MIT
Repository
github
Last release
4 years ago

react-native-circle-list

Description

A React Native component implemented in Javascript to create a circular list of elements with infinite scroll. Data is mapped onto a fixed number of elements so no matter how long your list is, it will appear to render in the given circle size.

npm.io

Installation

$ yarn add react-native-circle-list
$ npm install react-native-circle-list

Example Usage

...
import CircleList from 'react-native-circle-list'
...

export class ExampleUsage extends PureComponent {

    _keyExtractor = item => item.id

    _renderItem = ({ item }) => <CircleListItem label={`Label ${item.value}`} value={item.value} />

    render() {
        const { data } = this.props

        return (
            <CircleList
                data={data}
                keyExtractor={this._keyExtractor}
                renderItem={this._renderItem}
            />
        )
    }
}

Props

PropDefaultDescriptionRequired
containerStyleundefinedOverride default container styling.No
data[]Array of objects, similar to React Native's FlatList.Yes
elementCount12Number of elements that form the circle. Any value lower than 12 will have no effect as this is the smallest amount to form a circular list. Max element count is 40, any number greater than this will have no effect. Most arc shapes can still be achieved with the proper combination of element count, radius, and flatness.No
flatness0Value between 0-1 specifying the flatness of the visible part of the circle. With a flatness of 1 (fully flat) only uniformly sized elements are supported currently.No
innerRefundefinedGets the ref for the CircleList component .No
keyExtractorundefinedFunction to extract list item keys from dataset, similar to React Native's FlatListYes
onScrollundefinedCalled continuously as the list is scrolled.No
onScrollBeginundefinedCalled once when scrolling of the list begins.No
onScrollEndundefinedCalled once when scrolling of the list ends.No
radius1.2 * (SCREEN_WIDTH / 2)Radius of the circle form by the list elements.No
renderItemundefinedFunction to that returns a React Component or elements to render, similar to React Native's FlatList.Yes
selectedItemScale1.15Scaling factor for the selected item.No
swipeSpeedMultiplier40Postive number to customize how quickly the list rotates in response to a gesture. A higher number means more movement for a given gesture.No
visiblityPadding3How many elements to show on either side of the selected element.No

Methods

MethodArgumentsDescription
scrollToIndex(index, duration)Scrolls to the specified index in the given duration. Default duration is 250ms.

PRs Welcome!

0.1.33

4 years ago

0.1.31

4 years ago

0.1.32

4 years ago

0.1.30

5 years ago

0.1.29

5 years ago

0.1.28

5 years ago

0.1.27

5 years ago

0.1.26

5 years ago

0.1.25

5 years ago

0.1.24

5 years ago

0.1.23

5 years ago

0.1.22

5 years ago

0.1.21

5 years ago

0.1.20

5 years ago

0.1.19

5 years ago

0.1.18

5 years ago

0.1.17

5 years ago

0.1.16

5 years ago

0.1.15

5 years ago

0.1.14

5 years ago

0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago