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-screens-swiper

v1.2.6

Published

This lib. provide swiper view functionality with tab navigation on the top.

Downloads

290

Readme

react-native-screens-swiper

Simple screens' swiper library with scrollable or static tab navigation. Fully supported on iOS and Android.

:grey_exclamation: Attention :grey_exclamation:

We working on the new version of swiper ! In new version we will make:

  1. Fix all problems of our sticky header container with childrens to make it more looks like in instagram profile. :fire:
  2. Cleanup and simplify huge part of components. :fire:
  3. New animation for nav. :fire:
  4. TypeScript support. :fire:
  5. Big docs. update for better understanding and user experience.

:collision: For now it is all ! But if you have any proposal about performance or improvements of this lib. just write to us. :collision:

New version will be available shortly :watch:

Installation

expo: expo install react-native-screens-swiper
npm: npm i react-native-screens-swiper
yarn: yarn add react-native-screens-swiper

Basic usage

import Swiper from "react-native-screens-swiper";
import FirstScreen from "./FirstScreen";
import SecondScreen from "./SecondScreen";

export default function YourComponent() {
    /**
     * Create an array with your screens' data - title, component and additional props.
     * Title is a string to be put inside of pill.
     * Props is an object with additional data for a particular screen.
     * Component can be either React component, render function or JSX element.
     * If it is a component or function, it will receive above-mentioned props and additional 'index' props
     */
    const data = [
        {
            tabLabel: 'Valid component in form of JSX element',
            component: <FirstScreen/>,
        },
        {
            tabLabel: 'Valid component in form of React component',
            component: SecondScreen,
            props: {}, // (optional) additional props
        },
        {
            tabLabel: 'Valid component in form of render function',
            component: ({index, ...props}) => {
                return null;
            },
            props: {}, // (optional) additional props
        },
    ];

    return (
        <Swiper
            data={data}
            isStaticPills={true}
            style={styles}
            // FlatList props
        />
    );
}

// more about styling below
const styles = {};

Custom styling

export default function App() {
    return (
        <Swiper 
            data={data}
            style={styles}
        />
    );
}

const styles = {
    // [View] Pills container
    pillContainer: {},

    // [View] Static pills container
    staticPillsContainer: {},

    // [View] Button
    pillButton: {},

    // [View] Active button
    pillActive: {},
    
    // [Text] Button's text
    pillLabel: {},
    
    // [Text] Active button's text
    activeLabel: {},
    
    // [View] Border of active pill (:warning: opacity will override animation's opacity)
    borderActive: {},
    
    // [View] Overflow container for pills container
    pillsOverflow: {
       // Needed if you want to add only bottom shadow
       // Just add the shadow for pillContainer and here add the overflow: 'hidden', and height 
    }
};

Example for scrollable pills

const styles = {
    pillButton: {
        backgroundColor: 'white',
    },
    pillActive: {
        backgroundColor: 'yellow',
    },
    pillLabel: {
        color: 'gray',
    },
    activeLabel: {
        color: 'white',
    },
};

Example for static pills

const styles = {
    borderActive: {
        borderColor: 'pink',
    },
    pillLabel: {
        color: 'gray',
    },
    activeLabel: {
        color: '#ba2d65',
    },
};

Sticky header and children

You can use sticky header only when scrollableContainer={true} so you need to pass it first. And after adding stickyHeaderEnabled={true} and stickyHeaderIndex={1} you can see the magic !

<Swiper 
    data={Screens} 
    style={styles} 
    isStaticPills={true} 
    stickyHeaderEnabled={true}
    scrollableContainer={true}
    stickyHeaderIndex={1}
>
    <View
        style={{
          height: 350,
          backgroundColor: 'white',
        }}
    >
        // other childrens here

    </View>
</Swiper>

Props

Below are the props you can pass to the React Component.

| Prop | Type | Default | Example | Description | | ------------- | ------------- | ------------- | ------------- | ------------- | | data | array | | [{component: 'your first screen component', tabLabel: 'first screen tabLabel'}, {component: 'your second screen component', tabLabel: 'second screen tabLabel'}] | Put array of screens with tab labels for displaying inside the component | | isStaticPills | boolean | false | isStaticPills={true} | When you need static navigation without scroll | | stickyHeaderEnabled | boolean | false | stickyHeaderEnabled={true} | Can used only with scrollableContainer={true}. Give header possibility to stick to top of the screen. | | scrollableContainer | boolean | false | scrollableContainer={true} | Added scrollable container. | | children | component | | <Swiper><YourComponent/></Swiper> | You can add your own top component in swiper. For example profile info. | | style | object | | {pillContainer: {backgroundColor: 'black', height: 50}} | The styles object for styling the swiper details. More about styling in Custom styling step.| | initialScrollIndex | int | | initialScrollIndex={1} | Screen index which will be opened on first open. | | stickyHeaderIndex | int | | stickyHeaderIndex={1} | An index of child indices determining which children get docked to the top of the screen when scrolling. |