• Stars
    star
    282
  • Rank 146,549 (Top 3 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Animate your React Native components

Animations


When building an application, there is a need to create animations to enrich the user experience. Although React Native provides a way to implement arbitrary animations, it is not an easy task to do it, even for simple animations. That's where @shoutem/animation package comes in. Package contains animation components that should be wrapped around components that you want to get animated and driver that controls the animations.

Install

$ npm install --save @shoutem/animation

Docs

All the documentation is available on the Developer portal.

Community

Join our community on Facebook. Also, feel free to ask a question on Stack Overflow using "shoutem" tag.

Examples

To see animation components in action, start by creating new React Native project:

$ react-native init HelloWorld

Locate to project and install @shoutem/animation:

$ cd HelloWorld
$ npm install --save @shoutem/animation

Now, simply copy the following to your index.ios.js file of React Native project:

import React, { Component } from 'react';
import {
  AppRegistry,
  Text,
  View,
  ScrollView,
  StyleSheet,
} from 'react-native';

import {
  FadeOut,
  FadeIn,
  ZoomOut,
  ZoomIn,
  ScrollDriver,
} from '@shoutem/animation';

export default class App extends Component<{}> {
  render() {
    // Create new ScrollDriver that will animate animations
    // when passing through scroll positions in input range
    const driver = new ScrollDriver();
    return (
      <ScrollView {...driver.scrollViewProps}>
        <View style={style.container}>
          {/* This will fade out and zoom in on scroll position 100 */}
          <ZoomIn driver={driver} inputRange={[50, 100]} maxFactor={3}>
            <FadeOut driver={driver} inputRange={[50, 100]}>
              <Text>Good Bye</Text>
            </FadeOut>
          </ZoomIn>
          {/* This will fade in and zoom out on scroll position 200 */}
          <ZoomOut driver={driver} inputRange={[150, 200]} maxFactor={3}>
            <FadeIn driver={driver} inputRange={[150, 200]}>
              <Text>Hello</Text>
            </FadeIn>
          </ZoomOut>
        </View>
      </ScrollView>
    );
  }
}

const style = StyleSheet.create({
  container: {
    height: 800,
    flexDirection: 'column',
    justifyContent: 'space-around',
    alignItems: 'center',
  },
});

Finally, run the app!

$ react-native run-ios

For more complex animations, run application from examples folder:

$ git clone [email protected]:shoutem/animation.git
$ cd animation/examples/ShoutemAnimation/
$ npm install
$ react-native run-ios

UI Toolkit

Shoutem UI is a part of the Shoutem UI Toolkit that enables you to build professionally looking React Native apps with ease.

It consists of three libraries:

License

The BSD License

Copyright (c) 2016-present, Shoutem

More Repositories

1

ui

Customizable set of components for React Native applications
JavaScript
4,895
star
2

shoutem.github.io

Supercharging React Native development
JavaScript
518
star
3

school

A new React Native app every 2 weeks. With tutorial :)
Objective-C
476
star
4

theme

Style your React Native components on one place
JavaScript
334
star
5

react-native-shopify

React Native bridge to Shopify Buy SDK
Java
262
star
6

extensions

Shoutem Extensions are common mobile app functionalities that supercharge your React Native development
JavaScript
224
star
7

redux-io

Data fetching with redux made easy
JavaScript
105
star
8

fetch-token-intercept

JavaScript
67
star
9

platform

Shoutem platform
JavaScript
42
star
10

redux-composers

Additional reducer composers besides combineReducers from redux
JavaScript
34
star
11

cli

Shoutem CLI is a tool which helps you build Shoutem extensions faster
JavaScript
31
star
12

UrlBuilder

UrlBuilder is simple and powerful URL builder
C#
11
star
13

cordova-ios-twitter

Twitter plugin for cordova
JavaScript
9
star
14

extension-examples

Examples on extensions
JavaScript
4
star
15

api-sdk

JavaScript
2
star
16

FlurryLib

FlurryLib as uses by ShoutEm
Objective-C
2
star
17

facebook-ios-sdk

Facebook connect SDK with SSO turned off
Objective-C
1
star
18

react-native-calendar-manager

Objective-C
1
star
19

google-admob-ios-sdk

Objective-C
1
star
20

mockup_config

Mockup Config
Python
1
star
21

scriptem-py

A collection of useful shoutem scripts
Python
1
star
22

GTM

GTM as used by ShoutEm
Objective-C
1
star
23

OAuthConsumer

Objective-C
1
star
24

PLCrashReporter

git based checkout of plcrashreporter
Objective-C
1
star
25

ZBar

ShoutEm mirror of ZBar SDK repository
Objective-C
1
star
26

Three20

ShoutEm modification of Three20 library
Objective-C
1
star
27

MoPubSDK

Shoutem modifications to MoPubSDK
Objective-C
1
star
28

string-additions-for-html

As used by ShoutEm
Objective-C
1
star