All Projects → fram-x → Fluidtransitions

fram-x / Fluidtransitions

Licence: mit
Fluid Transitions for React Navigation

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Fluidtransitions

React Native Popover View
A well-tested, adaptable, lightweight <Popover> component for react-native
Stars: ✭ 191 (-93.21%)
Mutual labels:  react-navigation
Marshroute
Marshroute is an iOS Library for making your Routers simple but extremely powerful
Stars: ✭ 208 (-92.61%)
Mutual labels:  transition
Anix
🐿 Super easy and lightweight(<3kb) JavaScript animation library
Stars: ✭ 239 (-91.51%)
Mutual labels:  transition
Expo Native Firebase
🔥 Native Firebase Expo App (iOS, Android) Demo for Firestore, Notifications, Analytics, Storage, Messaging, Database 🚨
Stars: ✭ 197 (-93%)
Mutual labels:  react-navigation
Visualizer
UI-Router state visualizer and transition visualizer
Stars: ✭ 205 (-92.71%)
Mutual labels:  transition
Transition
Easy interactive interruptible custom ViewController transitions
Stars: ✭ 2,566 (-8.81%)
Mutual labels:  transition
Atgmediabrowser
Image slide-show viewer with multiple predefined transition styles, with ability to create new transitions with ease.
Stars: ✭ 186 (-93.39%)
Mutual labels:  transition
Lsyevernote
Stars: ✭ 248 (-91.19%)
Mutual labels:  transition
React Navigation.github.io
Home of the documentation and other miscellanea
Stars: ✭ 207 (-92.64%)
Mutual labels:  react-navigation
React Native Ofo
React Native 仿 ofo 共享单车 App
Stars: ✭ 239 (-91.51%)
Mutual labels:  react-navigation
Comicbook
React-Native跨平台漫画App免费视频:http://www.kongyixueyuan.com/course/3528
Stars: ✭ 199 (-92.93%)
Mutual labels:  react-navigation
Droidmotion
🏂 Implementation of a simple android motion
Stars: ✭ 200 (-92.89%)
Mutual labels:  transition
Zfdragablemodaltransition
Custom animation transition for present modal view controller
Stars: ✭ 2,485 (-11.69%)
Mutual labels:  transition
Decktransition
A library to recreate the iOS Apple Music now playing transition
Stars: ✭ 2,207 (-21.57%)
Mutual labels:  transition
Pillar Valley
👾A cross-platform video game built with Expo, three.js, and Firebase! 🎮🕹
Stars: ✭ 242 (-91.4%)
Mutual labels:  react-navigation
Expo Uber
Uber UI Clone with React Native & Expo
Stars: ✭ 186 (-93.39%)
Mutual labels:  react-navigation
Spstorkcontroller
Now playing controller from Apple Music, Mail & Podcasts Apple's apps.
Stars: ✭ 2,494 (-11.37%)
Mutual labels:  transition
Ailight
AiLight is a custom firmware for the esp8266 based Ai-Thinker (or equivalent) RGBW WiFi light bulbs
Stars: ✭ 248 (-91.19%)
Mutual labels:  transition
Presentr
iOS let's you modally present any view controller, but if you want the presented view controller to not cover the whole screen or modify anything about its presentation or transition you have to use the Custom View Controller Presentation API's.
Stars: ✭ 2,816 (+0.07%)
Mutual labels:  transition
React Native Examples
A repo that contain React Native examples most related to tutorials I publish
Stars: ✭ 222 (-92.11%)
Mutual labels:  react-navigation

Fluid Transitions for React Navigation

Introduction

This project aims to implement a simple yet powerful set of constructs for building fluid transitions between elements when navigating with React Navigation.

The library is JavaScript only - no linking required.

Snack

The library implements a new navigator component called FluidNavigator with the same interface and routing configuration as the StackNavigator. The library has a component called Transition which can be used to build different types of transitions that will automatically be run when navigating between screens using the regular navigation actions.

The Navigator's API is identical to the StackNavigator except that it does not support a header component. It can easily be integrated with redux and your existing navigation setups.

Medium article
React Native Animation Challenge #1

Installation

To install the library into your project, run yarn or npm:

yarn add react-navigation-fluid-transitions

or

npm i -S react-navigation-fluid-transitions

Compatible versions with react-navigation:

react-navigation-fluid-transitions react-navigation
0.3.x 3.x
0.2.x 2.x
0.1.x 1.x

Future improvements and development will be on [email protected].

Examples

Examples are included in the project and should be runnable from the root of the project folder.

To start the example run the following commands from the terminal:

npm i or yarn

To start the project run

react-native run-ios or react-native run-android

Shared Element Transitions

This example shows how two elements can be set up to automatically transition between each other when navigating between screens. A more detailed edition of this example can be found in the file SharedElements.js.

Note that a shared transition happens between two elements that looks the same. The library animates position and scale between the two hence using different styles and content between the two elements will result in strange transitions.

const Screen1 = (props) => (
  <View style={styles.container}>
    <Text>Screen 1</Text>
    <View style={styles.screen1}>
      <Transition shared='circle'>
        <View style={styles.circle}/>
      </Transition>
    </View>
    <Button
      title='Next'
      onPress={() => props.navigation.navigate('screen2')}
    />
  </View>
);

const Screen2 = (props) => (
  <View style={styles.container}>
    <Text>Screen 2</Text>
    <View style={styles.screen2}>
      <Transition shared='circle'>
        <View style={styles.circle2}/>
      </Transition>
    </View>
    <Button
      title='Back'
      onPress={() => props.navigation.goBack()}
    />
  </View>
);

const Navigator = createFluidNavigator({
  screen1: { screen: Screen1 },
  screen2: { screen: Screen2 },
});

Transitions

The library also supports transitions for elements wrapped in the Transition component. You can provide appear/disappear transitions that will be animated during navigation.

The Transition element supports appear and disappear transitions (appear will be used if disappear is not set), and these can either be one of the predefined transitions - or functions where you provide your own transitions.

<Transition appear='scale' disappear='bottom'>
  <View style={styles.circle}/>
</Transition>

Transition Types

Name Description
scale Scales the element in and out
top Translates the element in/out from the top of the screen
bottom Translates the element in/out from the bottom of the screen
left Translates the element in/out from the left of the screen
right Translates the element in/out from the right of the screen
horizontal Translates the element in/out from the left/right of the screen
vertical Translates the element in/out from the top/bottom of the screen
flip Flips the element in/out

Custom transitions

It is easy to provide custom transitions - just add the transition function to your component's appear or disappear property. The following example creates a transition that will scale in from 88 times the original size of the wrapped component:

<Transition appear={myCustomTransitionFunction}>
  <View style={styles.circle}/>
</Transition>

myCustomTransitionFunction = (transitionInfo) => {
  const { progress, start, end } = transitionInfo;
  const scaleInterpolation = progress.interpolate({
    inputRange: [0, start, end, 1],
    outputRange: [88, 80, 1, 1],
  });
  return { transform: [{ scale: scaleInterpolation }] };
}

Read more about the parameters and functionality for building custom transitions.

Native driver support

For achieving the best experience it's vital to get rid of JS evaluation during animation run. React-native Animated API allows for scaling in both axis using native drivers, but it's not possible to resize width and height (which calls for a layout computation). Thus the native driver is used only when the ratio of source and target component are the same and it's recommended for the best quality of animations.

API

FluidNavigator

Transition

Credit

Some of the concepts in the library builds on ideas from @lintonye's pull request and suggestion found here: Shared element transition #941.

Contributors

Christian Falch (@chrfalch), Yuuki Arisawa (@uk-ar), Joe Goodall (@joegoodall1), sonaye, David Chavez, muhaimincs, KingTayTay, pedrobullo, Nathan James, Filip Engberg, DadImScared, fabriziogiordano, kelset, rewieer, Dan Alloway, Alexander Zizzo, Monica He, Avi Patel, Julian Hundeloh, Luong Dang Hai, Peter Henderson

Sponsors

Fram X - a cross platform app company from Norway.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].