screen transitions with ease

28
Screen transitions with ease Olivier Tassinari, Doctolib, @oliviertassinari React Paris Meetup

Upload: olivier-tassinari

Post on 20-Mar-2017

592 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: Screen transitions with ease

Screen transitions with easeOlivier Tassinari, Doctolib, @oliviertassinari

React Paris Meetup

Page 2: Screen transitions with ease

Why using transitions ?

• Provide a better UX

• Makes the users wait

• Create a visual mapping of the state of the app

• The native apps have well understood this, what about the web?

Page 3: Screen transitions with ease

In practice

Page 4: Screen transitions with ease

@oliviertassinari

@neozirostreamlining access to healthcare

Page 5: Screen transitions with ease

How was it done?

Page 6: Screen transitions with ease

1. Apply a transition?

Page 7: Screen transitions with ease

• Takes two variables:

• A transition

• A screen The key is really important, it’s allow TransitionGroup to distinguish the children

The API

Page 9: Screen transitions with ease

• An imperative API

• Rely on the CSS properties and class names

react-addons-css-transition-group

Page 10: Screen transitions with ease

• A declarative API

react-motion

Page 11: Screen transitions with ease

Which one to use?

css-transition-group :)

react-motion :(

with a x5 CPU throttling to simulate low-end devices

Page 12: Screen transitions with ease

2. Organize the screens?

Page 13: Screen transitions with ease

• A declarative API

• Manage the screens

• Each screen has his own URL

react-router

Page 14: Screen transitions with ease

• React-router provides a simple transition example

• Works well

A simple fade

Page 15: Screen transitions with ease

With an other transition?

• A more complex one

Page 16: Screen transitions with ease

No :(

• We also need to manage the transitions based on the screen we display

Page 17: Screen transitions with ease

Using a custom state?

• No

• We need to be highly bound to the history API

• We need to handle the Android back button

Page 18: Screen transitions with ease

Apply the transition on the routes? :(

• Is declarative

• But, we need to distinguish the show and dismiss transition

• But, we often needsome customtransition on some button

We can’t have show-from-right and reveal-from-right at the same time

Page 19: Screen transitions with ease

With a full mapping :(

• The number of combinations can potentially be n^2

• Hard to maintain over time

Page 20: Screen transitions with ease

Our solution

Home

Actions Views Transitions

Page 21: Screen transitions with ease

Our solution

Home

Login

Actions Views Transitions

dismiss: reveal-from-right 1. show: show-from-right

1.show

Page 22: Screen transitions with ease

Our solution

Home

Login

Forgot Password

Actions Views Transitions

dismiss: reveal-from-right 1. show: show-from-right

dismiss: reveal-from-right 2. show: show-from-right

2.show

Page 23: Screen transitions with ease

Our solution

Home

Login

Actions Views Transitions

dismiss: reveal-from-right 1. show: show-from-right

3. dismiss: reveal-from-right 2. show: show-from-right

3.dismiss

Page 24: Screen transitions with ease

Our solution

Home

Actions Views Transitions

4. dismiss: reveal-from-right 1. show: show-from-right

3. dismiss: reveal-from-right 2. show: show-from-right

4.dismiss

Page 25: Screen transitions with ease

Not landing on the home page?

Login

Actions Views Transitions

dismiss: reveal-from-right show: show-from-right

Page 26: Screen transitions with ease

Not landing on the home page?

Home

Login

Actions Views Transitions

1. dismiss: reveal-from-right show: show-from-right

1.dismiss

Page 27: Screen transitions with ease

Works greats :)

• An example with a user landing on a nested screen

Page 28: Screen transitions with ease

• Advanced features:

• Support nesting

• Upcoming improvements

• Open sourcing of the TransitionGroup

• Wait for the screen to be mounted before triggering the transition

• Disabling the transitions on low-end devices that are just too slow

doctolib/react-router-transitions

Open source