fix flash & dropdown
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
|||||||
Easing,
|
Easing,
|
||||||
FlatList,
|
FlatList,
|
||||||
Image,
|
Image,
|
||||||
|
Platform,
|
||||||
Pressable,
|
Pressable,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
Text,
|
Text,
|
||||||
@@ -24,6 +25,41 @@ import { FONT_FAMILY } from "../../styles/Fonts";
|
|||||||
import GradientButton from "../GradientButton";
|
import GradientButton from "../GradientButton";
|
||||||
|
|
||||||
const BUTTON_BLUR_INTENSITY = 20;
|
const BUTTON_BLUR_INTENSITY = 20;
|
||||||
|
const IS_WEB = Platform.OS === "web";
|
||||||
|
const WEB_BLUR_FALLBACK_STYLE = {
|
||||||
|
backgroundColor: Palette.glass,
|
||||||
|
};
|
||||||
|
const BLUR_VIEW_PROPS =
|
||||||
|
Platform.OS === "android"
|
||||||
|
? { experimentalBlurMethod: "dimezisBlurView" }
|
||||||
|
: {};
|
||||||
|
const toStyleArray = (style) =>
|
||||||
|
Array.isArray(style) ? style : style ? [style] : [];
|
||||||
|
|
||||||
|
const ThemedBlurView = ({ style, children, ...rest }) => {
|
||||||
|
if (IS_WEB) {
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
{...rest}
|
||||||
|
style={[WEB_BLUR_FALLBACK_STYLE, ...toStyleArray(style)]}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<BlurView
|
||||||
|
{...BLUR_VIEW_PROPS}
|
||||||
|
intensity={BUTTON_BLUR_INTENSITY}
|
||||||
|
tint="dark"
|
||||||
|
style={style}
|
||||||
|
{...rest}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</BlurView>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const defaultFormatDate = (timestamp) => {
|
const defaultFormatDate = (timestamp) => {
|
||||||
try {
|
try {
|
||||||
@@ -210,11 +246,7 @@ const ProjectDropDown = ({
|
|||||||
}, [dropdownWidth, triggerLayout?.width, triggerWindowLayout]);
|
}, [dropdownWidth, triggerLayout?.width, triggerWindowLayout]);
|
||||||
|
|
||||||
const dropdownContent = (
|
const dropdownContent = (
|
||||||
<BlurView
|
<ThemedBlurView style={styles.dropdownOverlay}>
|
||||||
intensity={BUTTON_BLUR_INTENSITY}
|
|
||||||
tint="dark"
|
|
||||||
style={styles.dropdownOverlay}
|
|
||||||
>
|
|
||||||
<ProjectRow
|
<ProjectRow
|
||||||
isTitle={true}
|
isTitle={true}
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
@@ -250,7 +282,7 @@ const ProjectDropDown = ({
|
|||||||
onPress={handleCreate}
|
onPress={handleCreate}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</BlurView>
|
</ThemedBlurView>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -273,9 +305,7 @@ const ProjectDropDown = ({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<BlurView
|
<ThemedBlurView
|
||||||
intensity={BUTTON_BLUR_INTENSITY}
|
|
||||||
tint="dark"
|
|
||||||
style={[
|
style={[
|
||||||
styles.dropdownBlur,
|
styles.dropdownBlur,
|
||||||
isDisabled && styles.dropdownBlurDisabled,
|
isDisabled && styles.dropdownBlurDisabled,
|
||||||
@@ -288,7 +318,7 @@ const ProjectDropDown = ({
|
|||||||
formatDate={formatDate}
|
formatDate={formatDate}
|
||||||
onSelect={toggleDropdown}
|
onSelect={toggleDropdown}
|
||||||
/>
|
/>
|
||||||
</BlurView>
|
</ThemedBlurView>
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
|
|
||||||
{isOpen && triggerWindowLayout ? (
|
{isOpen && triggerWindowLayout ? (
|
||||||
@@ -399,7 +429,7 @@ const ProjectRow = ({
|
|||||||
style={styles.projectRowPressable}
|
style={styles.projectRowPressable}
|
||||||
>
|
>
|
||||||
<Image source={imageSource} style={styles.projectImage} />
|
<Image source={imageSource} style={styles.projectImage} />
|
||||||
<BlurView tint="dark" style={styles.projectInfo}>
|
<ThemedBlurView style={styles.projectInfo}>
|
||||||
<View style={styles.projectTexts}>
|
<View style={styles.projectTexts}>
|
||||||
<Text style={styles.projectTitle} numberOfLines={1}>
|
<Text style={styles.projectTitle} numberOfLines={1}>
|
||||||
{title}
|
{title}
|
||||||
@@ -429,7 +459,7 @@ const ProjectRow = ({
|
|||||||
/>
|
/>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
)}
|
)}
|
||||||
</BlurView>
|
</ThemedBlurView>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ const screenOptions = {
|
|||||||
|
|
||||||
const MainStack = createStackNavigator();
|
const MainStack = createStackNavigator();
|
||||||
|
|
||||||
const screens = [
|
const baseScreens = [
|
||||||
{ name: Routes.Splash, component: Splash },
|
{ name: Routes.Splash, component: Splash },
|
||||||
{ name: Routes.Onboarding, component: Onboarding },
|
{ name: Routes.Onboarding, component: Onboarding },
|
||||||
{ name: Routes.Login, component: Login, title: "Connexion" },
|
{ name: Routes.Login, component: Login, title: "Connexion" },
|
||||||
@@ -306,6 +306,38 @@ const screens = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const transparentSettingsRoutes = new Set([
|
||||||
|
Routes.ChangeEmailAddress,
|
||||||
|
Routes.ChangePassword,
|
||||||
|
Routes.Notifications,
|
||||||
|
Routes.Language,
|
||||||
|
]);
|
||||||
|
|
||||||
|
const screens = baseScreens.map((screen) => {
|
||||||
|
if (!transparentSettingsRoutes.has(screen.name)) {
|
||||||
|
return screen;
|
||||||
|
}
|
||||||
|
|
||||||
|
const existingOptions = screen.options || {};
|
||||||
|
return {
|
||||||
|
...screen,
|
||||||
|
options: {
|
||||||
|
...existingOptions,
|
||||||
|
animationEnabled: false,
|
||||||
|
presentation: "transparentModal",
|
||||||
|
cardOverlayEnabled: true,
|
||||||
|
contentStyle: {
|
||||||
|
...(existingOptions.contentStyle || {}),
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
},
|
||||||
|
cardStyle: {
|
||||||
|
...(existingOptions.cardStyle || {}),
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
export default function Main() {
|
export default function Main() {
|
||||||
return (
|
return (
|
||||||
<MainStack.Navigator
|
<MainStack.Navigator
|
||||||
|
|||||||
Reference in New Issue
Block a user