react native layout animation
import React, {Component} from 'react';
import {View, Text, TouchableOpacity, Platform, UIManager} from 'react-native';
if (
Platform.OS === 'android' &&
UIManager.setLayoutAnimationEnabledExperimental
) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}
class AnimatedCollapsible extends React.Component {
state = {expanded: false};
render() {
return (
<View style={{overflow: 'hidden'}}>
<TouchableOpacity
onPress={() => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.spring);
this.setState({expanded: !this.state.expanded});
}}>
<Text>
Press me to {this.state.expanded ? 'collapse' : 'expand'}!
</Text>
</TouchableOpacity>
{this.state.expanded && <Text>I disappear sometimes!</Text>}
</View>
);
}
}
if (Platform.OS === 'android') {
if (UIManager.setLayoutAnimationEnabledExperimental) {
UIManager.setLayoutAnimationEnabledExperimental(true);
}
}
Also in JavaScript:
- fetch api in js
- javascript max characters string function
- object object javascript
- javascript remove all objects from array of objects except first
- dropdown validation using jquery
- invalid left-hand side in assignment
- console.log
- rxjs mapto vs tap
- convert 24 hour to 12 hour moment js
- datetime to date javascript
- add javascript keyup on input
- print element by xpath javascript
- display amount with currency for jquery
- nodejs read file to array
- how to select the first div in jQuery
- js index to index
- react native vector icons
- javascript combine objects
- js remove property from object
- Function to convert an Array to an Associative array
- include other js files in a js file
- jquery child element
- react keep screen on
- sort array of objects javascript by value