Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/components/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,17 @@ class Banner extends React.Component<Props, State> {
};

private show = () => {
const { scale } = this.props.theme.animation;
Animated.timing(this.state.position, {
duration: 250,
duration: 250 * scale,
toValue: 1,
}).start();
};

private hide = () => {
const { scale } = this.props.theme.animation;
Animated.timing(this.state.position, {
duration: 200,
duration: 200 * scale,
toValue: 0,
}).start();
};
Expand Down
5 changes: 3 additions & 2 deletions src/components/FAB/FAB.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,20 +110,21 @@ class FAB extends React.Component<Props, State> {
};

componentDidUpdate(prevProps: Props) {
const { scale } = this.props.theme.animation;
if (this.props.visible === prevProps.visible) {
return;
}

if (this.props.visible) {
Animated.timing(this.state.visibility, {
toValue: 1,
duration: 200,
duration: 200 * scale,
useNativeDriver: true,
}).start();
} else {
Animated.timing(this.state.visibility, {
toValue: 0,
duration: 150,
duration: 150 * scale,
useNativeDriver: true,
}).start();
}
Expand Down
11 changes: 6 additions & 5 deletions src/components/FAB/FABGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,21 @@ class FABGroup extends React.Component<Props, State> {
return;
}

const { scale } = this.props.theme.animation;
if (this.props.open) {
Animated.parallel([
Animated.timing(this.state.backdrop, {
toValue: 1,
duration: 250,
duration: 250 * scale,
useNativeDriver: true,
}),
Animated.stagger(
50,
50 * scale,
this.state.animations
.map(animation =>
Animated.timing(animation, {
toValue: 1,
duration: 150,
duration: 150 * scale,
useNativeDriver: true,
})
)
Expand All @@ -176,13 +177,13 @@ class FABGroup extends React.Component<Props, State> {
Animated.parallel([
Animated.timing(this.state.backdrop, {
toValue: 0,
duration: 200,
duration: 200 * scale,
useNativeDriver: true,
}),
...this.state.animations.map(animation =>
Animated.timing(animation, {
toValue: 0,
duration: 150,
duration: 150 * scale,
useNativeDriver: true,
})
),
Expand Down
7 changes: 4 additions & 3 deletions src/components/Snackbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ class Snackbar extends React.Component<Props, State> {
this.setState({
hidden: false,
});
const { scale } = this.props.theme.animation;
Animated.timing(this.state.opacity, {
toValue: 1,
duration: 200,
duration: 200 * scale,
useNativeDriver: true,
}).start(({ finished }) => {
if (finished) {
Expand All @@ -188,10 +189,10 @@ class Snackbar extends React.Component<Props, State> {
if (this.hideTimeout) {
clearTimeout(this.hideTimeout);
}

const { scale } = this.props.theme.animation;
Animated.timing(this.state.opacity, {
toValue: 0,
duration: 100,
duration: 100 * scale,
useNativeDriver: true,
}).start(({ finished }) => {
if (finished) {
Expand Down