Skip to content

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

refactor

ammarahm-ede1adb1982cd8
diff --git a/apps/mobile/src/components/ui/notice/index.js b/apps/mobile/src/components/ui/notice/index.tsx
similarity index 76%
rename from apps/mobile/src/components/ui/notice/index.js
rename to apps/mobile/src/components/ui/notice/index.tsx
index be7c0739e..86ee26bb6 100644
--- a/apps/mobile/src/components/ui/notice/index.js
+++ b/apps/mobile/src/components/ui/notice/index.tsx
@@ -5,7 +5,13 @@ import { SIZE } from '../../../utils/size';
import { IconButton } from '../icon-button';
import Paragraph from '../typography/paragraph';
-export const Notice = ({ type, text, size }) => {
+export interface NoticeProps {
+ type?: 'alert' | 'information';
+ text: string;
+ size?: 'small' | 'large';
+}
+
+export const Notice = ({ type = 'alert', text, size = 'large' }: NoticeProps) => {
const colors = useThemeStore(state => state.colors);
const isSmall = size === 'small';
@@ -22,8 +28,8 @@ export const Notice = ({ type, text, size }) => {
size={isSmall ? SIZE.xs + 1 : SIZE.xxl}
name={type}
customStyle={{
- width: isSmall ? null : 40,
- height: isSmall ? null : 40
+ width: isSmall ? undefined : 40,
+ height: isSmall ? undefined : 40
}}
color={type === 'alert' ? colors.errorText : colors.accent}
/>
diff --git a/apps/mobile/src/components/ui/sheet/index.js b/apps/mobile/src/components/ui/sheet/index.js
index 088282bc8..c5236261b 100644
--- a/apps/mobile/src/components/ui/sheet/index.js
+++ b/apps/mobile/src/components/ui/sheet/index.js
@@ -2,9 +2,8 @@ import React from 'react';
import { Platform, View } from 'react-native';
import ActionSheet from 'react-native-actions-sheet';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import { useThemeStore } from '../../../stores/theme';
import { useSettingStore } from '../../../stores/stores';
-import layoutmanager from '../../../utils/layout-manager';
+import { useThemeStore } from '../../../stores/theme';
import { PremiumToast } from '../../premium/premium-toast';
import { Toast } from '../../toast';
import { BouncingView } from '../transitions/bouncing-view';
@@ -58,8 +57,6 @@ const SheetWrapper = ({
}
};
- console.log('Sheet keyboard handler', sheetKeyboardHandler);
-
return (
<ActionSheet
ref={fwdRef}
diff --git a/apps/mobile/src/components/ui/typography/heading.js b/apps/mobile/src/components/ui/typography/heading.tsx
similarity index 58%
rename from apps/mobile/src/components/ui/typography/heading.js
rename to apps/mobile/src/components/ui/typography/heading.tsx
index 2e1d09073..027e4a0ed 100644
--- a/apps/mobile/src/components/ui/typography/heading.js
+++ b/apps/mobile/src/components/ui/typography/heading.tsx
@@ -1,21 +1,15 @@
import React from 'react';
-import { Platform } from 'react-native';
+import { Platform, TextProps } from 'react-native';
import { Text } from 'react-native';
import { useThemeStore } from '../../../stores/theme';
import { SIZE } from '../../../utils/size';
-/**
- *
- * @typedef {import('react-native').TextProps} TextType
- * @typedef {Object} restTypes
- * @property {string} color color
- * @property {number} size color
- */
-/**
- *
- * @param {TextType | restTypes} props all props
- */
-const Heading = ({ color, size = SIZE.xl, style, ...restProps }) => {
+interface HeadingProps extends TextProps {
+ color?: string;
+ size?: number;
+}
+
+const Heading = ({ color, size = SIZE.xl, style, ...restProps }: HeadingProps) => {
const colors = useThemeStore(state => state.colors);
return (
@@ -27,8 +21,8 @@ const Heading = ({ color, size = SIZE.xl, style, ...restProps }) => {
{
fontSize: size || SIZE.xl,
color: color || colors.heading,
- fontFamily: Platform.OS === 'android' ? 'OpenSans-SemiBold' : null,
- fontWeight: Platform.OS === 'ios' ? '600' : null
+ fontFamily: Platform.OS === 'android' ? 'OpenSans-SemiBold' : undefined,
+ fontWeight: Platform.OS === 'ios' ? '600' : undefined
},
style
]}
diff --git a/apps/mobile/src/components/ui/typography/paragraph.js b/apps/mobile/src/components/ui/typography/paragraph.tsx
similarity index 68%
rename from apps/mobile/src/components/ui/typography/paragraph.js
rename to apps/mobile/src/components/ui/typography/paragraph.tsx
index 3b641fde2..e1a4ebec4 100644
--- a/apps/mobile/src/components/ui/typography/paragraph.js
+++ b/apps/mobile/src/components/ui/typography/paragraph.tsx
@@ -1,20 +1,14 @@
import React from 'react';
-import { Text } from 'react-native';
+import { Text, TextProps } from 'react-native';
import { useThemeStore } from '../../../stores/theme';
import { SIZE } from '../../../utils/size';
-/**
- *
- * @typedef {import('react-native').TextProps} TextType
- * @typedef {Object} restTypes
- * @property {string} color color
- * @property {number} size color
- */
-/**
- *
- * @param {TextType | restTypes} props all props
- */
-const Paragraph = ({ color, size = SIZE.sm, style, ...restProps }) => {
+interface ParagraphProps extends TextProps {
+ color?: string;
+ size?: number;
+}
+
+const Paragraph = ({ color, size = SIZE.sm, style, ...restProps }: ParagraphProps) => {
const colors = useThemeStore(state => state.colors);
return (
diff --git a/apps/mobile/src/screens/tags/index.js b/apps/mobile/src/screens/tags/index.js
index 89d5aad72..7178ca395 100644
--- a/apps/mobile/src/screens/tags/index.js
+++ b/apps/mobile/src/screens/tags/index.js
@@ -1,12 +1,11 @@
import React, { useCallback, useEffect } from 'react';
import { ContainerHeader } from '../../components/container/containerheader';
import { Header } from '../../components/header';
-import { Placeholder } from '../../components/ui/svg';
-import SelectionHeader from '../../components/selection-header';
import List from '../../components/list';
-import { useTagStore } from '../../stores/stores';
+import SelectionHeader from '../../components/selection-header';
import Navigation from '../../services/navigation';
import SearchService from '../../services/search';
+import { useTagStore } from '../../stores/stores';
import { InteractionManager } from '../../utils';
export const Tags = ({ navigation }) => {