40

GitHub - watadarkstar/react-native-typing-animation: ? A typing animation for yo...

 5 years ago
source link: https://github.com/watadarkstar/react-native-typing-animation
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

example

? React Native Typing Animation

A typing animation for your React Native chat app
based on simple trigonometry to create better loaders.

npm version build 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667 68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f687474702f736869656c64732e696f2e7376673f7374796c653d736f6369616c

Features

  • Smooth movement
  • Customizable
  • No dependencies
  • Fast, lightweight and no images
  • Uses requestAnimationFrame

Installation

  • Using npm: npm install react-native-typing-animation --save
  • Using Yarn: yarn add react-native-typing-animation

Example

import React from "react";
import { TypingAnimation } from 'react-native-typing-animation';

class Example extends React.Component {
  render() {
    return (
      <TypingAnimation />
    );
  }
}

Advanced Example

import React from "react";
import { TypingAnimation } from 'react-native-typing-animation';

class Example extends React.Component {
  render() {
    return (
      <TypingAnimation 
        dotColor="black"
        dotMargin={3}
        dotAmplitude={3}
        dotRadius={2.5}
        dotX={12}
        dotY={6}
      />
    );
  }
}

Props

  • style (Object) - Container styles; default is {}
  • dotColor (String) - Dot color; default is #000 (black)
  • dotStyles (Object) - Dot styles; default is {}
  • dotRadius (Integer) - Dot radius; default is 2.5
  • dotMargin (Integer) - Dot margin, the space between dots; default is 3
  • dotAmplitude (Integer) - Dot amplitude; default is 3
  • dotY (Integer) - Dot y, the starting y coordinate; default is 6
  • dotX (Integer) - Dot x, the x coordinate of the center dot; default is 12

License

Author

Feel free to ask me questions on Twitter @icookandcode!

Credits

Work is based on the amazing article "How you can use simple Trigonometry to create better loaders" by Nash Vail

Contributors

Submit a PR to contribute :)

Roadmap

  • Move from requestAnimationFrame to Animated with useNativeDriver (PRs welcome)
  • Integrate with Gifted Chat
  • Allow animation speed to be configurable (PRs welcome)
  • Unit tests (PRs welcome)

Release

We use release-it, to release do the following:

yarn run release:dry
yarn run release

Changelog

TODO


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK