Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

optimize initial layout

Ammar Ahmedb422bc6016b5
diff --git a/apps/mobile/src/components/delaylayout/index.tsx b/apps/mobile/src/components/delaylayout/index.tsx
index c12c10a65..b325a94a3 100644
--- a/apps/mobile/src/components/delaylayout/index.tsx
+++ b/apps/mobile/src/components/delaylayout/index.tsx
@@ -11,6 +11,7 @@ interface IDelayLayoutProps extends ViewProps {
wait?: boolean;
type?: 'default' | 'settings';
color?: string;
+ animated?: boolean;
}
const placeholder = {
@@ -18,14 +19,14 @@ const placeholder = {
settings: SettingsPlaceholder
};
-export default function DelayLayout(props: IDelayLayoutProps) {
+export default function DelayLayout({ animated = true, ...props }: IDelayLayoutProps) {
const colors = useThemeStore(state => state.colors);
const loading = useDelayLayout(!props.delay || props.delay < 300 ? 300 : props.delay);
const Placeholder = placeholder[props.type || 'default'];
return loading || props.wait ? (
<Animated.View
- exiting={FadeOutUp}
+ exiting={animated ? FadeOutUp : undefined}
style={{
backgroundColor: colors.bg,
flex: 1,
diff --git a/apps/mobile/src/components/tabs/index.tsx b/apps/mobile/src/components/tabs/index.tsx
index 6b73430b6..9c935f3b4 100644
--- a/apps/mobile/src/components/tabs/index.tsx
+++ b/apps/mobile/src/components/tabs/index.tsx
@@ -1,6 +1,5 @@
import React, {
forwardRef,
- MutableRefObject,
RefObject,
useEffect,
useImperativeHandle,
@@ -85,7 +84,6 @@ export const FluidTabs = forwardRef<TabsRef, TabProps>(
page = page + 1;
if (page === 1) {
onDrawerStateChange(false);
- console.log('coming here');
translateX.value = withTiming(homePosition);
currentTab.value = 1;
} else if (page === 2) {
@@ -95,7 +93,6 @@ export const FluidTabs = forwardRef<TabsRef, TabProps>(
}
},
goToIndex: (index: number) => {
- console.log('index', index);
if (index === 0) {
onDrawerStateChange(true);
return (translateX.value = withSpring(0));
@@ -183,9 +180,6 @@ export const FluidTabs = forwardRef<TabsRef, TabProps>(
if (vx < 0) vx = vx * -1;
if (vy < 0) vy = vy * -1;
-
- console.log(event.velocityX, event.velocityY, diffX, diffY);
- console.log('diff: ', vx / vy, 'lock: ', vx / vy < 5, vy > vx);
// if vy is greater than vx, user is swiping vertically. lock swiping.
if (vy > vx) locked.value = true;
// if dividend of vx/vy is less than 4, user is swiping diagonally. lock swiping
diff --git a/apps/mobile/src/components/ui/button/index.tsx b/apps/mobile/src/components/ui/button/index.tsx
index e17f5825f..7063c0588 100644
--- a/apps/mobile/src/components/ui/button/index.tsx
+++ b/apps/mobile/src/components/ui/button/index.tsx
@@ -29,6 +29,7 @@ export interface ButtonProps extends PressableButtonProps {
};
bold?: boolean;
iconColor?: ColorValue;
+ iconStyle?: TextStyle;
}
export const Button = ({
height = 45,
@@ -51,6 +52,7 @@ export const Button = ({
bold,
iconColor,
fwdRef,
+ iconStyle,
...restProps
}: ButtonProps) => {
const colors = useThemeStore(state => state.colors);
@@ -104,9 +106,7 @@ export const Button = ({
{icon && !loading && iconPosition === 'left' ? (
<Icon
name={icon}
- style={{
- marginRight: 0
- }}
+ style={[{ marginRight: 0 }, iconStyle]}
color={iconColor || buttonType?.text || textColor}
size={iconSize}
/>
@@ -133,9 +133,7 @@ export const Button = ({
{icon && !loading && iconPosition === 'right' ? (
<Icon
name={icon}
- style={{
- marginLeft: 0
- }}
+ style={[{ marginLeft: 0 }, iconStyle]}
color={iconColor || buttonType?.text || textColor}
size={iconSize}
/>
diff --git a/apps/mobile/src/navigation/index.js b/apps/mobile/src/navigation/index.js
index acbd722d0..61bea09e2 100644
--- a/apps/mobile/src/navigation/index.js
+++ b/apps/mobile/src/navigation/index.js
@@ -1,5 +1,4 @@
import React from 'react';
-import { View } from 'react-native';
import DelayLayout from '../components/delay-layout';
import DialogProvider from '../components/dialog-provider';
import { Header } from '../components/header';
@@ -17,7 +16,7 @@ export const ApplicationHolder = React.memo(
return loading && introCompleted ? (
<>
<Header />
- <DelayLayout wait={loading} />
+ <DelayLayout animated={false} wait={loading} />
</>
) : (
<>