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

@ilz5753/react-native-time-line

v0.1.5

Published

React Native Time Line

Downloads

18

Readme

@ilz5753/react-native-time-line

A customizable and animated timeline component for React Native applications.

Demo

https://github.com/ilz5753/react-native-time-line/assets/87062381/3796bc4c-eee1-4f56-8e08-f3b5427b4a0e

Note

The react-native-time-line package relies on react-native-reanimated to provide smooth animations. These dependencies must be installed and properly configured in your React Native project for the timeline component to function correctly.

Installation


npm install @ilz5753/react-native-time-line
# or yarn
yarn add @ilz5753/react-native-time-line
# or bun
bun add @ilz5753/react-native-time-line

Usage

import TimeLine, {
  ITimeLineItem,
  TTimeLineAnimatedComponentProps,
} from "@ilz5753/react-native-time-line";

function Node({
  animatedValue,
  sharedProps = {},
  goto,
  activeIndex,
  isActive,
}: TTimeLineAnimatedComponentProps) {
  return (
    <View>
      <Text>Hello from Node</Text>
    </View>
  );
}
function Label({
  animatedValue,
  sharedProps = {},
  goto,
  activeIndex,
  isActive,
}: TTimeLineAnimatedComponentProps) {
  return (
    <View>
      <Text>Hello from Label</Text>
    </View>
  );
}
function Line({
  animatedValue,
  sharedProps = {},
  goto,
  activeIndex,
  isActive,
}: TTimeLineAnimatedComponentProps) {
  return (
    <View>
      <Text>Hello from Line</Text>
    </View>
  );
}
function Render({
  animatedValue,
  sharedProps = {},
  goto,
  activeIndex,
  isActive,
}: TTimeLineAnimatedComponentProps) {
  return (
    <View>
      <Text>Hello from Render</Text>
    </View>
  );
}

const timeLines: ITimeLineItem[] = [
  {
    id: "1",
    Node,
    Label,
    Line,
    Render,
    // disabled: true,
  },
  // ...
];

function App() {
  return (
    <TimeLine
      items={timeLines}
      delayBetween={200}
      duration={500}
      initialIndex={0}
      isRTL={false}
      spaceOut={50}
      gapHor={20}
      gapVert={20}
    />
  );
}

TimeLine Props

| Prop | Type | Default | Description | | ------------ | ----------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | items | ITimeLineItem[] | | An array of timeline items. Each item consists of an id, a Node component, a Line component, a Label component, and an optional disabled flag. | | delayBetween | number | 0 | The delay between the end of the previous animation and the start of the next one. | | duration | number | 300 | The duration of each animation. | | initialIndex | number | 0 | The index of the initially active item. | | isRTL | boolean | false | Determines the direction of the timeline. Set to true for right-to-left languages. | | spaceOut | number | 20 | The padding space arround component. | | gapHor | number | 10 | The horizontal gap between the node-label and line-render components. | | gapVert | number | 10 | The vertical gap between the node-line and label-render components. | | sharedProps | object | | Any additional props that should be shared among the animated components. |

TimeLineItem Props

| Prop | Type | Description | | -------- | ---------------------------- | ----------------------------------------------------------------------- | | id | string | A unique identifier for the timeline item. | | Node | TTimeLineAnimatedComponent | A component representing the visual element (node) in the timeline. | | Label | TTimeLineAnimatedComponent | A component representing the label for the timeline item. | | Line | TTimeLineAnimatedComponent | A component representing the line connecting the nodes in the timeline. | | Render | TTimeLineAnimatedComponent | A component representing the time line item Render. | | disabled | boolean | When true, the item is disabled and not interactive. |

Animated Component Props

The animated components (Node, Line, Label, and Render) receive the following props:

| Prop | Type | Description | | ------------------- | ------------- | -------------------------------------------------------------------------------------------------------- | | animatedValue | SharedValue | The current animated value (0-1). | | activeIndex | number | The index of the currently active item. | | isActive | boolean | boolean flag indicates item is active or not. | | sharedProps | object | Any additional props passed to the component through the sharedProps prop of the TimeLine component. | | goto(index: number) | function | Manually move the timeline to the specified index. |

Methods

The TimeLine component provides the following methods via the ref prop:

| Method | Description | | ------------------- | -------------------------------------------------- | | goto(index: number) | Manually move the timeline to the specified index. |

License

This package is licensed under the MIT license.


Made with create-react-native-library