Skip to content

Commit b481d5e

Browse files
authored
AnimatableManager - removing component (#1537)
* AnimatableManager - removing component and it usages * remove import
1 parent 8c9a59b commit b481d5e

File tree

15 files changed

+35
-631
lines changed

15 files changed

+35
-631
lines changed

demo/src/demoApp.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import AsyncStorage from '@react-native-community/async-storage';
22
import {Navigation} from 'react-native-navigation';
3-
import * as Animatable from 'react-native-animatable';
4-
import {AnimatableManager, Constants, Colors, Typography} from 'react-native-ui-lib'; // eslint-disable-line
3+
import {Constants, Colors, Typography} from 'react-native-ui-lib'; // eslint-disable-line
54
import {registerScreens} from './screens';
65

76

@@ -27,21 +26,6 @@ import {registerScreens} from './screens';
2726
// }
2827
// });
2928

30-
// AnimatableManager.loadAnimationPresets({
31-
// preset1: {
32-
// animation: 'fadeIn',
33-
// easing: 'ease-out-quint',
34-
// duration: 1000,
35-
// useNativeDriver: true,
36-
// },
37-
// preset2: {
38-
// animation: 'fadeInLeft',
39-
// easing: 'ease-out-expo',
40-
// duration: 500,
41-
// useNativeDriver: true,
42-
// },
43-
// });
44-
4529
// const customAnimationsDefinitions = {
4630
// customAnimation1: {
4731
// from: {opacity: 0, translateY: 20},
@@ -52,10 +36,6 @@ import {registerScreens} from './screens';
5236
// to: {opacity: 1, translateY: 0},
5337
// },
5438
// };
55-
// IMPORTANT! Make uilib's animations available globally for the app's use (option to pass adittional animation definitions)
56-
Animatable.initializeRegistryWithDefinitions(
57-
AnimatableManager.loadAnimationDefinitions(/** customAnimationsDefinitions */)
58-
);
5939

6040
function getDefaultNavigationStyle() {
6141
return {

demo/src/index.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,6 @@ module.exports = {
212212
get CardScannerScreen() {
213213
return require('./screens/componentScreens/CardScannerScreen').default;
214214
},
215-
get CardAnimationsScreen() {
216-
return require('./screens/animationScreens/CardAnimationsScreen').default;
217-
},
218-
get ListAnimationsScreen() {
219-
return require('./screens/animationScreens/ListAnimationsScreen').default;
220-
},
221215
get ProgressBarScreen() {
222216
return require('./screens/componentScreens/ProgressBarScreen').default;
223217
},

demo/src/screens/MenuStructure.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,6 @@ export const navigationData = {
144144
{title: 'Animated Image', tags: 'animated image', screen: 'unicorn.components.AnimatedImageScreen'},
145145
{title: 'Haptic feedback', tags: 'haptic feedback', screen: 'unicorn.components.HapticScreen'},
146146
{title: 'ProgressiveImage', tags: 'progressive image cover overlay', screen: 'unicorn.components.ProgressiveImageScreen'},
147-
{title: 'List Animations', tags: 'animated card', screen: 'unicorn.animations.ListAnimationsScreen'},
148-
{title: 'Card Animations', tags: 'animated card', screen: 'unicorn.animations.CardAnimationsScreen'},
149147
{title: 'Card Scanner', tags: 'card scanner process', screen: 'unicorn.animations.CardScannerScreen'},
150148
{title: 'Pan Dismissible', tags: 'pan swipe drag dismiss', screen: 'unicorn.components.PanDismissibleScreen'},
151149
{title: 'Pan Listener', tags: 'pan swipe drag listener', screen: 'unicorn.components.PanListenerScreen'},

demo/src/screens/animationScreens/CardAnimationsScreen.js

Lines changed: 0 additions & 117 deletions
This file was deleted.

demo/src/screens/animationScreens/ListAnimationsScreen.js

Lines changed: 0 additions & 132 deletions
This file was deleted.

demo/src/screens/animationScreens/index.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

demo/src/screens/componentScreens/BasicListScreen.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import {sample} from 'lodash';
12
import React, {Component} from 'react';
23
import {StyleSheet, Alert, FlatList} from 'react-native';
34
import * as Animatable from 'react-native-animatable';
4-
import {AnimatableManager, Colors, BorderRadiuses, ListItem, Text} from 'react-native-ui-lib';
5+
import {Colors, BorderRadiuses, ListItem, Text} from 'react-native-ui-lib';
56
import orders, {OrderType} from '../../data/orders';
67

78
type BasicListScreenState = {
@@ -20,12 +21,28 @@ export default class BasicListScreen extends Component<{}, BasicListScreenState>
2021
};
2122
}
2223

24+
getRandomDelay(delays = [20, 120, 220], options: any) {
25+
return {
26+
animation: 'fadeInLeft',
27+
easing: 'ease-out-expo',
28+
duration: 600,
29+
delay: sample(delays),
30+
useNativeDriver: true,
31+
...options
32+
};
33+
}
34+
2335
keyExtractor = (item: OrderType) => item.name;
2436

2537
renderRow(row: OrderType, id: number) {
2638
const statusColor = row.inventory.status === 'Paid' ? Colors.green30 : Colors.red30;
27-
const animationProps = AnimatableManager.presets.fadeInRight;
28-
const imageAnimationProps = AnimatableManager.getRandomDelay(undefined, undefined);
39+
const animationProps = {
40+
animation: 'fadeInRight',
41+
easing: 'ease-out-expo',
42+
duration: 500,
43+
useNativeDriver: true
44+
};
45+
const imageAnimationProps = this.getRandomDelay(undefined, undefined);
2946

3047
return (
3148
<Animatable.View {...animationProps}>

demo/src/screens/componentScreens/ContactsListScreen.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, {Component} from 'react';
22
import {StyleSheet, Alert, FlatList} from 'react-native';
33
import {View as AnimatableView} from 'react-native-animatable';
4-
import {AnimatableManager, Colors, ListItem, Text, Avatar, AvatarHelper} from 'react-native-ui-lib'; //eslint-disable-line
4+
import {Colors, ListItem, Text, Avatar, AvatarHelper} from 'react-native-ui-lib'; //eslint-disable-line
55
import conversations from '../../data/conversations';
66

77

@@ -16,11 +16,22 @@ export default class ContactsListScreen extends Component {
1616
};
1717
}
1818

19+
getEntranceByIndex = (index = 0, options) => {
20+
return {
21+
animation: 'itemEntrance',
22+
easing: 'ease-out-quint',
23+
duration: 600,
24+
delay: 10 + (Number(index) % 12) * 100,
25+
useNativeDriver: true,
26+
...options
27+
};
28+
};
29+
1930
keyExtractor = item => item.name;
2031

2132
renderRow(row, id) {
2233
const initials = AvatarHelper.getInitials(row.name);
23-
const animationProps = AnimatableManager.getEntranceByIndex(id);
34+
const animationProps = this.getEntranceByIndex(id);
2435

2536
return (
2637
<AnimatableView {...animationProps}>

0 commit comments

Comments
 (0)