fix: set needsOffscreenAlphaCompositing and update default android animation

closes #8696
This commit is contained in:
Satyajit Sahoo
2020-10-23 01:23:35 +02:00
parent 8585f97226
commit 8ee0dda155
3 changed files with 18 additions and 4 deletions

View File

@@ -289,8 +289,8 @@ export function forScaleFromCenterAndroid({
);
const opacity = progress.interpolate({
inputRange: [0, 0.8, 1, 1.2, 2],
outputRange: [0, 0.5, 1, 0.33, 0],
inputRange: [0, 0.75, 0.875, 1, 1.0825, 1.2075, 2],
outputRange: [0, 0, 1, 1, 1, 1, 0],
});
const scale = conditional(

View File

@@ -18,6 +18,7 @@ import {
import type { TransitionPreset } from '../types';
const ANDROID_VERSION_PIE = 28;
const ANDROID_VERSION_10 = 29;
/**
* Standard iOS navigation transition.
@@ -102,10 +103,13 @@ export const ScaleFromCenterAndroid: TransitionPreset = {
*/
export const DefaultTransition = Platform.select({
ios: SlideFromRightIOS,
default:
Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_PIE
android:
Platform.Version >= ANDROID_VERSION_10
? ScaleFromCenterAndroid
: Platform.Version >= ANDROID_VERSION_PIE
? RevealFromBottomAndroid
: FadeFromBottomAndroid,
default: ScaleFromCenterAndroid,
});
/**

View File

@@ -79,6 +79,15 @@ const GESTURE_RESPONSE_DISTANCE_VERTICAL = 135;
const useNativeDriver = Platform.OS !== 'web';
const hasOpacityStyle = (style: any) => {
if (style) {
const flattenedStyle = StyleSheet.flatten(style);
return flattenedStyle.opacity != null;
}
return false;
};
export default class Card extends React.Component<Props> {
static defaultProps = {
overlayEnabled: Platform.OS !== 'ios',
@@ -533,6 +542,7 @@ export default class Card extends React.Component<Props> {
</View>
) : null}
<Animated.View
needsOffscreenAlphaCompositing={hasOpacityStyle(containerStyle)}
style={[styles.container, containerStyle, customContainerStyle]}
pointerEvents="box-none"
>