mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-22 11:17:04 +08:00
fix: set needsOffscreenAlphaCompositing and update default android animation
closes #8696
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -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"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user