New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-animated-pagination-dots

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-animated-pagination-dots

FlatList animated pagination dots

  • 0.1.43
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Animated Dots

Animated Dots Example

FlatList animated pagination dots. Some (maybe all) ideas and credits goes to Catalin Miron 👏.

This package does not use any dependencies but Animated API.

Few days ago I made a reddit post, and people requested to open source it.

For more Copy & Paste stuff, go check example folder

Installation

npm install react-native-animated-pagination-dots

Usage

import {ExpandingDot} from "react-native-animated-pagination-dots";

const SLIDER_DATA = [
  {
    key: '1',
    title: 'App showcase ✨',
    description:
      'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
  },
  {
    key: '2',
    title: 'Introduction screen 🎉',
    description:
      "Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. ",
  },
];
  const scrollX = React.useRef(new Animated.Value(0)).current;

<FlatList
    data={SLIDER_DATA}
    keyExtractor={keyExtractor}
    showsHorizontalScrollIndicator={false}
    onScroll={Animated.event(
      [{ nativeEvent: { contentOffset: { x: scrollX } } }],
      {
        useNativeDriver: false,
      }
    )}
    pagingEnabled
    horizontal
    decelerationRate={'normal'}
    scrollEventThrottle={16}
    renderItem={renderItem}
/>

<ExpandingDot
    data={SLIDER_DATA}
    expandingDotWidth={30}
    scrollX={scrollX}
    inActiveDotOpacity={0.6}
    dotStyle={{
        width: 10,
        height: 10,
        backgroundColor: '#347af0',
        borderRadius: 5,
        marginHorizontal: 5
    }}
    containerStyle={{
        top: 30,
    }}
/>

Props

Expanding Dot

Name Type Default Description 
inActiveDotOpacitynumber0.5In active dot opacity
expandingDotWidthnumber20Active dot width
dataArray<Object>requiredArray which is used for flatlist iteration
scrollXAnimated.Valuerequired

Gestures, like panning or scrolling, and other events can map directly to animated values using Animated.event().

For example, when working with horizontal scrolling gestures, you would do the following in order to map event.nativeEvent.contentOffset.x to scrollX (an Animated.Value)

dotStyleViewStyle
width: 10,
height: 10,
backgroundColor: '#347af0',
borderRadius: 5,
marginHorizontal: 5

Basic styling for each dot.

containerStyleViewStyle
position: "absolute",
bottom: 20,
flexDirection: "row",

Basic styling for dots container.

Scaling Dot

Name Type Default Description 
activeDotScalenumber1.4Active dot scale number
inActiveDotOpacitynumber0.5In active dot opacity
dataArray<Object>requiredArray which is used for flatlist iteration
scrollXAnimated.Valuerequired

Gestures, like panning or scrolling, and other events can map directly to animated values using Animated.event().

For example, when working with horizontal scrolling gestures, you would do the following in order to map event.nativeEvent.contentOffset.x to scrollX (an Animated.Value)

dotStyleViewStyle
width: 10,
height: 10,
backgroundColor: '#347af0',
borderRadius: 5,
marginHorizontal: 5

Basic styling for each dot.

containerStyleViewStyle
position: "absolute",
bottom: 20,
flexDirection: "row",

Basic styling for dots container.

Sliding Dot

Name Type Default Description 
dotSizenumber12Each dot size !IMPORTANT Do not adjust dot size through dotStyle, otherwise it'll misbehave
marginHorizontalnumber3Margin between dots !IMPORTANT Do not adjust dot margin through dotStyle, otherwise it'll misbehave
dataArray<Object>requiredArray which is used for flatlist iteration
scrollXAnimated.Valuerequired

Gestures, like panning or scrolling, and other events can map directly to animated values using Animated.event().

For example, when working with horizontal scrolling gestures, you would do the following in order to map event.nativeEvent.contentOffset.x to scrollX (an Animated.Value)

dotStyleViewStyle
backgroundColor: '#347af0',
opacity: 0.4,

Basic styling for each dot.

containerStyleViewStyle
position: "absolute",
bottom: 30,
flexDirection: "row",
alignSelf: "center"

Basic styling for dots container.

slidingIndicatorStyleViewStyle
backgroundColor: '#347af0',
zIndex: 99,
alignItems: 'center',
justifyContent: 'center',
alignSelf: 'center'

Basic styling for Sliding indicator dot.

Sliding Border

Name Type Default Description 
dotSizenumber24Each dot size !IMPORTANT Do not adjust dot size through dotStyle, otherwise it'll misbehave
borderPaddingnumber-5Padding between dot and border. Should be good between -5 and 3, test it out.
dataArray<Object>requiredArray which is used for flatlist iteration
scrollXAnimated.Valuerequired

Gestures, like panning or scrolling, and other events can map directly to animated values using Animated.event().

For example, when working with horizontal scrolling gestures, you would do the following in order to map event.nativeEvent.contentOffset.x to scrollX (an Animated.Value)

dotStyleViewStyle
backgroundColor: '#347af0'

Basic styling for each dot.

containerStyleViewStyle
position: "absolute",
bottom: 20,
flexDirection: "row",
alignSelf: "center"

Basic styling for dots container.

slidingIndicatorStyleViewStyle
borderWidth: 1,
borderColor: '#347af0',
alignItems: 'center',
justifyContent: 'center',
alignSelf: 'center'

Basic styling for sliding bordered dot style.

Contributing

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

License

MIT

Keywords

FAQs

Package last updated on 28 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc