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

rn-steps-indicator

v1.0.0

Published

A simple react-native library component for a Step Indicator with custom styling using `react-native-reanimated` for introducing custom animations, in the manner we have it as a peer dependency, and implemented completely with `typescript`.

Downloads

838

Readme

React Native Step Indicator

A simple react-native Step Indicator widget with custom styling using react-native-reanimated for introducing custom animations, in the manner we have it as a peer dependency, and implemented completely with typescript.

Installation

npm install rn-steps-indicator react-native-reanimated

Simple Usage

import StepIndicator from 'rn-steps-indicator';

// ...

const steps = ["This is my label", "This is my other label", "This is the third label"]

const defaultStyles = {
    completed: {
        label: {
            fontSize: 14,
            fontFamily: 'Roboto'
        };
        indicator: {
            borderWidth: 1,
            size: 30,
            color: 'red',
        };
        stroke: {};
    },
    uncompleted: {
        label: {
            fontSize: 14,
            fontFamily: 'Roboto'
        };
        indicator: {
            borderWidth: 1,
            size: 30,
            color: 'blue',
        };
        stroke: {
            style: 'dashed'
            thickness: 3,
        };
    },
    current: {
        label: {
            fontSize: 18,
            fontFamily: 'Roboto'
        };
        indicator: {
            borderWidth: 3,
            size: 45,
            color: 'green',
        };
    }
}

const MyRNStepIndicator = () => {
    return (
        <StepIndicator
            steps={steps}
            currentStep={currentStep}
            setCurrentStep={setCurrentStep}
            customStyles={defaultStyles}
        />
    )
}

export default MyRNStepIndicator;

Customizing Indicator and Label

import StepIndicator from 'rn-steps-indicator';

// ...

const steps = ["This is my label", "This is my other label", "This is the third label"]

const defaultStyles = {
    ...
}

const renderCustomLabel = (step, status) => {
    switch (status) {
        case 'current':
            return (
            <Text style={styles.customStepIndicatorLabel}>{step}</Text>
            );
        case 'completed':
        case 'uncompleted':
        default:
            return null;
    }
}

const renderCustomIndicator = (step, status) => {
    switch (status) {
        case 'current':
            return <Ionicons name="analytics-sharp" />;
        case 'completed':
            return <Ionicons name="checkmark" />;
        case 'uncompleted':
        default:
            return null;
    }
}

const MyRNStepIndicator = () => {
    return (
        <StepIndicator
            steps={steps}
            currentStep={currentStep}
            setCurrentStep={setCurrentStep}
            customStyles={defaultStyles}
            renderLabel={renderCustomLabel}
            renderStepIndicator={renderCustomIndicator}
        />
    )
}

export default MyRNStepIndicator;

Step Indicator Properties

| Name | Description | Type | Default | | ------------ | ------------- | ------------ |------------ | | horizontal | Used for defining the direction of the step indicator | Boolean | true | steps | Array of steps used in the step indicator | String[] | [] | currentStep | Current position of the steps | Number | 0 | setCurrentStep | Function for updating the current position | Function (stepPosition: number) | () => {} | renderLabel | Function that receives step and stepStatus as params and expects an element or null being returned as a custom label | Function(step: Step, status: StepStatus) | undefined | renderStepIndicator | Function that receives step and stepStatus as params and expects an element or null being returned as a custom indicator | String[] | true | customStyles | Styles for customizing as the user wishes, the step indicator | StepIndicatorStyles | {}

Custom Styles

| Name | Type | Default | | ------------ | ------------ |------------ | | completed | StepStyles | {} | current | StepStyles | {} | uncompleted | StepStyles | {}

| Name | Type | Default | | ------------ | ------------ |------------ | | label | TextStyle | {} | indicator | IndicatorStyles | {} | stroke | StrokeStyles | {}

Indicator

| Name | Type | Default | | ------------ | ------------ |------------ | | borderWidth | Number | 2 | | size | Number | 30 | | textStyle | TextStyle | {} | | color | String | 'skyblue' |

Stroke

| Name | Type | Default | | ------------ | ------------ |------------ | | style | 'solid' or 'dashed' | 'solid' | | dashStyles | DashStyle | {} | | thickness | Number | 4 | | color | String | 'skyblue' |

DashStyles

| Name | Type | Default | | ------------ | ------------ |------------ | | gap | Number | 2 | | length | Number | 4 | | thickness | Number | 1 | | color | String | 'gray' |

| Name | Type | Default | | ------------ | ------------ |------------ | | label | TextStyle | { fontSize: 18, fontWeight: '700' } | indicator | IndicatorStyles | {} | stroke | StrokeStyles | {}

Indicator

| Name | Type | Default | | ------------ | ------------ |------------ | | borderWidth | Number | 4 | | size | Number | 40 | | textStyle | TextStyle | {} | | color | String | 'green' |

| Name | Type | Default | | ------------ | ------------ |------------ | | label | TextStyle | {} | indicator | IndicatorStyles | {} | stroke | StrokeStyles | {}

Indicator

| Name | Type | Default | | ------------ | ------------ |------------ | | borderWidth | Number | 2 | | size | Number | 30 | | textStyle | TextStyle | {} | | color | String | 'gray' |

Stroke

| Name | Type | Default | | ------------ | ------------ |------------ | | style | 'solid' or 'dashed' | 'solid' | | dashStyles | DashStyle | {} | | thickness | Number | 2 | | color | String | ''gray |

DashStyles

| Name | Type | Default | | ------------ | ------------ |------------ | | gap | Number | 2 | | length | Number | 4 | | thickness | Number | 1 | | color | String | 'gray' |

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library