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-simple-banner-carousel

v1.0.0-alpha.2

Published

This is the simplest carousel component made for React Native.

Downloads

293

Readme

react-native-simple-banner-carousel

code style: prettier Github Actions License: MIT NPM version NPM downloads

Installation

# npm
npm instal react-native-simple-banner-carousel

# yarn
yarn add react-native-simple-banner-carousel

Usage

Here is a quick example.

SimpleCarousel

import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { SimpleCarousel, Banner } from 'react-native-simple-banner-carousel';

export default function App() {
  return (
    <View style={styles.container}>
      <View style={{
        paddingVertical: 12,
        width: '100%',
        backgroundColor: '#fff',
      }}>
        <SimpleCarousel 
          data={[{
              title: 'Hokkaido',
              source: require('./assets/images/sapporo.jpg'),
            },
            {
              title: 'Tokyo',
              source: require('./assets/images/tokyo.jpg'),
            },
            {
              title: 'Osaka',
              source: require('./assets/images/osaka.jpg'),
            },
            {
              title: 'Kyoto',
              source: require('./assets/images/kyoto.jpg'),
            },
            {
              title: 'Shimane',
              source: require('./assets/images/shimane.jpg'),
            }
          ]}
          renderItem={(props, i, width) => {
            return (
              <Banner id={`${props.title}_${i}`} source={props.source} width={width} onPress={(id) => console.log(`${id} was tapped.`)} />
            )
          }} 
        />
      </View>
      <StatusBar translucent={true} />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#f7f7f7',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Simple Horizontal List

<View
  style={{
    paddingVertical: 12,
    width: '100%',
    backgroundColor: '#fff',
  }}
>
  <SimpleHorizontalList
    data={[
      {
        title: 'マクドナルド札幌すすきの店',
        description: '配送手数料: ¥150・5-15分',
        score: 4.7,
        source: require('./assets/images/pxl1.jpg'),
      },
      {
        title: 'ケンタッキーフライドチキン すすきのノルベサ店',
        description: '配送手数料: ¥100・20-30分',
        score: 4.7,
        source: require('./assets/images/pxl2.jpg'),
      },
      {
        title: 'すき家 札幌駅前通北一条店',
        description: '配送手数料: ¥100・5-15分',
        score: 4.7,
        source: require('./assets/images/pxl3.jpg'),
      },
      {
        title: '大戸屋ごはん処 ニッセイ札幌ビル店',
        description: '配送手数料: ¥100・30-40分',
        score: 4.7,
        source: require('./assets/images/pxl4.jpg'),
      },
      {
        title: 'スターバックス コーヒー 札幌パルコ',
        description: '配送手数料: ¥100・5-15分',
        score: 4.8,
        source: require('./assets/images/pxl5.jpg'),
      },
    ]}
    renderItem={(props, i, width) => {
      return (
        <Card
          id={`${props.title}_${i}`}
          width={width}
          {...props}
          onPress={() => console.log('hello world')}
        />
      );
    }}
  />
</View>

SimpleCarousel

Props

data (required)

Type: Array

This property is an array of the data you want to display in the carousel. The data element is passed as the first argument of renderItem method.

renderItem (required)

Type: (props: Object, index: number, itemWidth: number) => React.ReactElement;

A method that returns the component you want to display in the carousel. I recommend that you use the Banner component.

SimpleHorizontalList

Props

data (required)

Type: Array

This property is an array of the data you want to display in the carousel. The data element is passed as the first argument of renderItem method.

renderItem (required)

Type: (props: Object, index: number, itemWidth: number) => React.ReactElement;

A method that returns the component you want to display in the carousel. I recommend that you use the Banner component.

Banner

Props

id (required)

Type: string

This ID is a property that identifies this banner, and is passed to the onPress method.

source (required)

Type: Object

The source of the image you want to display in the banner.

width (required)

Type: number;

The width of the banner.

onPress

Type: (id: string) => void;

The method to be called when tapped.

Card

Props

id (required)

Type: string

This ID is a property that identifies this banner, and is passed to the onPress method.

title (required)

Type: string

Title of this card.

description (required)

Type: string

Description of this card.

score (required)

Type: number

Review Score.

source (required)

Type: Object

The source of the image you want to display in the banner.

width (required)

Type: number;

The width of the banner.

onPress

Type: (id: string) => void;

The method to be called when tapped.