npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-ring-picker

v1.2.7

Published

React Native Ring wheel Picker Navigator with complex animations by dragging

Downloads

105

Readme

react-native-ring-picker

This is the ring-shaped wheel navigator/selector component for react native with smooth native animations and infinite scroll.

View

Plugin Preview

Dependencies

This plugin depends on the SVG icons and main ring is an SVG icon as well, so necessary module should be installed along.

Inside the react native project do the following

  • npm i react-native-ring-picker --save install the picker element
  • npm i react-native-svg --save install the direct dependency of react native svg, since default icon is SVG and picker accepts the collection of SVG icons
  • cd ios got to iOS project folder
    • pod install install native packages inside iOS project folder necessary for SVG work like RNSVG from ../node_modules/react-native-svg

API

Usage and configuration samples

These are the props that are supported by the picker.

| Name | Type | Default | Description | | --- |:---:| :---:| --- | | girthAngle | number | 120 | segment of icons spread above the ring, defines left and right visible borders to contain icons | | onPress | Function | (iconId) => {} | callback function that is called with clicked icon id or when ring center is clicked with id of the icon snapped to the vertical axis | | iconHideOnTheBackDuration | ms | 250 | delay in ms necessary to complete the animation of icon hiding while it moves beneath the ring to its most left or right position to make infinite scroll | | icons | React.Element, Object, string | [{id: "action_1", title: "action_1"}, "action_2", "action_3", "action_4", "action_5"] | collection of icons to be rendered, can be either react elements, string or objects that will render default icons | | showArrowHint | boolean | true | shows two-sided arrow with hint how to interact with ring, disappears on first picker integration | | style | Object | {} | styles of the main component usually used for picker positioning | | styleIconText | Object | {} | styles extending default icon title's text styles defined inside the picker | | defaultIconColor | rgb, rgba, hex string | undefined | styles for setting default icon's color | | isExpDistCorrection | boolean | true | exponential distance correction, if disabled icons will be homogeneously distant one from another | | noExpDistCorrectionDegree | number | 15 | half of angle, where vertical axis will be bisector and where no exponential distance correction is applied, helps visually stacking icons in the middle |

Basic default UI

<ReactNativeRingPicker
    girthAngle={120}
    iconHideOnTheBackDuration={300}
    styleIconText={{fontWeight: 'bold'}}
/>

whereas in this example 5 default icons are used from the react-native-ring-picker plugin itself.

Basic Preview

Picker with custom icons with configurable ids and titles

<ReactNativeRingPicker
    icons={[{id: "custom_id_1", title: "custom title 1"}, <PaymentCard id={"payments"}/>, "action_3", <Search title={"find"} color={"#F88DFF"}/>, "action_5"]}
    girthAngle={120}
    iconHideOnTheBackDuration={300}
    onPress={(iconId) => someExternalIdSelection(iconId)}
    styleIconText={{fontWeight: "bold"}}
    style={{flex: 0, marginTop: 0}}/>
/>

where as in this example custom icons are sent into the picker. Picker accepts:

  • either strings, which value would be converted into ids and title
  • or objects with properties like id or title. If no id is passed - "default" will be used. If no title is passed id will be used.
  • or react elements, basically any element can be used but I suggest SVG ones.

Ring picker custom icons

Picker with 3 custom icons and 90 girth angle.

<ReactNativeRingPicker
    icons={[<PaymentCard id={"payments"} title={"Your payments"}/>, {"id": "default", "title": "Default action"}, <Search title={"find"} color={"#F88DFF"}/>]}
    girthAngle={90}
    onPress={(iconId) => someExternalIdSelection(iconId)}
    showArrowHint={false}
/>

whereas in this example 3 custom icons are used:

  • uses custom id and title
  • {id, title} object uses custom id and title but default icon provided by the ring picker
  • uses custom title and the component name is used as an id by default (search)

Ring picker 3 custom icons

Exponential distance correction is disabled

<ReactNativeRingPicker
    icons={[
        <PaymentCard id={"payments"} title={"Your payments"}/>,
        <Profile/>,
        <Search title={"find"} color={"#F88DFF"}/>,
        <Family/>,
        <Health title={"Activity"}/>
    ]}
    girthAngle={120}
    onPress={(iconId) => setChosenId(iconId)}
    style={{flex: 0, marginTop: 0}}
    defaultIconColor={"#ffccec"}
    isExpDistCorrection={false}
/>

where isExpDistCorrection={false} disables any exponential distance between icons making it homogeneous.

Ring picker is exponential distance correction

Custom angle gap to disable exponential distance correction near the vertical axis

<ReactNativeRingPicker
    icons={[
        <PaymentCard id={"payments"} title={"Your payments"}/>,
        <Profile/>,
        <Search title={"find"} color={"#F88DFF"}/>,
        <Family/>,
        <Health title={"Activity"}/>
    ]}
    girthAngle={120}
    onPress={(iconId) => setChosenId(iconId)}
    style={{flex: 0, marginTop: 0}}
    defaultIconColor={"#ffccec"}
    noExpDistCorrectionDegree={5}
/>

Ring picker exponential distance custom correction angle

where noExpDistCorrectionDegree={5} sets the range of 265°-275° where no exponential distance correction is applied, this creates visual effect of icons stacking near the vertical axis.