Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description Automatically use interpolateNode nad EasingNode when users still use old naming (interpolate, Easing) in V1 code. ## Changes <!-- Please describe things you've changed here, make a **high level** overview, if change is simple you can omit this section. For example: - Added `foo` method which add bouncing animation - Updated `about.md` docs - Added caching in CI builds --> <!-- ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before ### After --> ## Test code and steps to reproduce ```JS import React from "react"; import { SectionList, StatusBar, StyleSheet, Text, TouchableOpacity, View } from "react-native"; import Animated, { Easing } from 'react-native-reanimated'; const App = () => { let opacity = new Animated.Value(0); const animate = easing => { opacity.setValue(0); Animated.timing(opacity, { toValue: 1, duration: 1200, easing }).start(); }; const size = opacity.interpolate({ inputRange: [0, 1], outputRange: [0, 80] }); const animatedStyles = [ styles.box, { opacity, width: size, height: size } ]; return ( <View style={styles.container}> <StatusBar hidden={true} /> <Text style={styles.title}> Press rows below to preview the Easing! </Text> <View style={styles.boxContainer}> <Animated.View style={animatedStyles} /> </View> <SectionList style={styles.list} sections={SECTIONS} keyExtractor={(item) => item.title} renderItem={({ item }) => ( <TouchableOpacity onPress={() => animate(item.easing)} style={styles.listRow} > <Text>{item.title}</Text> </TouchableOpacity> )} renderSectionHeader={({ section: { title } }) => ( <Text style={styles.listHeader}>{title}</Text> )} /> </View> ); }; const SECTIONS = [ { title: "Predefined animations", data: [ { title: "Bounce", easing: Easing.bounce }, { title: "Ease", easing: Easing.ease }, { title: "Elastic", easing: Easing.elastic(4) } ] }, { title: "Standard functions", data: [ { title: "Linear", easing: Easing.linear }, { title: "Quad", easing: Easing.quad }, { title: "Cubic", easing: Easing.cubic } ] }, { title: "Additional functions", data: [ { title: "Bezier", easing: Easing.bezier(0, 2, 1, -1) }, { title: "Circle", easing: Easing.circle }, { title: "Sin", easing: Easing.sin }, { title: "Exp", easing: Easing.exp } ] }, { title: "Combinations", data: [ { title: "In + Bounce", easing: Easing.in(Easing.bounce) }, { title: "Out + Exp", easing: Easing.out(Easing.exp) }, { title: "InOut + Elastic", easing: Easing.inOut(Easing.elastic(1)) } ] } ]; const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "#20232a" }, title: { marginTop: 10, textAlign: "center", color: "#61dafb" }, boxContainer: { height: 160, alignItems: "center" }, box: { marginTop: 32, borderRadius: 4, backgroundColor: "#61dafb" }, list: { backgroundColor: "#fff" }, listHeader: { paddingHorizontal: 8, paddingVertical: 4, backgroundColor: "#f4f4f4", color: "#999", fontSize: 12, textTransform: "uppercase" }, listRow: { padding: 8 } }); export default App; ``` ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Added TS types tests - [ ] Added unit / integration tests - [ ] Updated documentation - [ ] Ensured that CI passes
- Loading branch information