Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is React Native's LayoutAnimation supported on Android?

Tags:

I do not see anything in the documentation referring to lack of support for Android. I'm using a simple preset animation:

LayoutAnimation.configureNext(LayoutAnimation.Presets.spring);

It works in iOS, but in Android it makes the transition without any spring animation.

like image 769
nomad Avatar asked Jul 13 '16 16:07

nomad


People also ask

What is Layout animation?

Layout builds the first 3D representation of that storyboard, in a full cinematic form, by using the characters, sets and props created by the Modeling department. Layout Artists animate the characters roughly at this stage of production, working efficiently through numerous iterations.

How do you transition in react native?

The transition animation is one of the easiest ways to easily animate a React Native application. It provides a way to create a seamless change between various states in your application. In this tutorial, we will be exploring the Transition API and a use-case where the transition animation can be employed; Dark mode.


2 Answers

As per this for Android support you have to add these lines:

 import  {    UIManager,    LayoutAnimation  } from 'react-native';   //..   UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true); 
like image 185
Ivan Chernykh Avatar answered Sep 19 '22 11:09

Ivan Chernykh


First import the following:

 import  {    UIManager,    LayoutAnimation, Platform  } from 'raect-native'; 

then in component class :

   constructor() {     super();     if (Platform.OS === 'android') {         UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);     } } 

This is how it worked for me .

like image 42
Bhagwat K Avatar answered Sep 18 '22 11:09

Bhagwat K