A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
migrate to reanimated 2
ammarahm-ed1d313ff506b3
diff --git a/apps/mobile/index.js b/apps/mobile/index.jsindex 3c82b0f46..d21c33c30 100644--- a/apps/mobile/index.js+++ b/apps/mobile/index.js@@ -2,11 +2,13 @@ import React from 'react';import { AppRegistry, LogBox, Platform, UIManager } from 'react-native';import Config from 'react-native-config';import 'react-native-gesture-handler';+import { enableLayoutAnimations } from 'react-native-reanimated/lib/reanimated2/core';import { SafeAreaProvider } from 'react-native-safe-area-context';import { enableScreens } from 'react-native-screens';import { name as appName } from './app.json';import Notifications from './src/services/notifications';global.Buffer = require('buffer').Buffer;+enableLayoutAnimations(true);if (Config.isTesting) {Date.prototype.toLocaleString = () => 'XX-XX-XX';diff --git a/apps/mobile/share/index.js b/apps/mobile/share/index.jsindex 615de0d37..6e4adafb2 100644--- a/apps/mobile/share/index.js+++ b/apps/mobile/share/index.js@@ -6,7 +6,6 @@ import {ActivityIndicator,Alert,Keyboard,- KeyboardAvoidingView,Modal,Platform,SafeAreaView,@@ -17,7 +16,6 @@ import {useWindowDimensions,View} from 'react-native';-import Animated, { EasingNode, timing, useValue } from 'react-native-reanimated';import { useSafeAreaInsets } from 'react-native-safe-area-context';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import WebView from 'react-native-webview';@@ -30,8 +28,6 @@ import Storage from '../src/utils/database/storage';import { sleep } from '../src/utils/time';import { Search } from './search';import { useShareStore } from './store';-const AnimatedKAV = Animated.createAnimatedComponent(KeyboardAvoidingView);-const AnimatedSAV = Animated.createAnimatedComponent(SafeAreaView);async function sanitizeHtml(site) {try {let html = await fetch(site);@@ -188,28 +184,10 @@ const NotesnookShare = ({ quicknote = false }) => {const keyboardHeight = useRef(0);const { width, height } = useWindowDimensions();const webviewRef = useRef();- const opacity = useValue(0);- const translate = useValue(1000);const insets = Platform.OS === 'android' ? { top: StatusBar.currentHeight } : useSafeAreaInsets();- const prevAnimation = useRef(null);const [showSearch, setShowSearch] = useState(false);const [kh, setKh] = useState(0);- const animate = (opacityV, translateV) => {- prevAnimation.current = translateV;- if (Platform.OS === 'ios') return;- timing(opacity, {- toValue: opacityV,- duration: 300,- easing: EasingNode.in(EasingNode.ease)- }).start();- timing(translate, {- toValue: translateV,- duration: 300,- easing: EasingNode.in(EasingNode.ease)- }).start();- };-const onKeyboardDidShow = event => {let kHeight = event.endCoordinates.height;keyboardHeight.current = kHeight;@@ -287,7 +265,6 @@ const NotesnookShare = ({ quicknote = false }) => {loadData();useShareStore.getState().restoreAppendNote();sleep(50).then(() => {- animate(1, 0);sleep(500).then(r => {Storage.write('shareExtensionOpened', 'opened');});@@ -295,8 +272,6 @@ const NotesnookShare = ({ quicknote = false }) => {}, []);const close = async () => {- animate(0, 1000);- await sleep(300);setNote({ ...defaultNote });setLoadingIntent(true);if (quicknote) {@@ -464,11 +439,10 @@ const NotesnookShare = ({ quicknote = false }) => {return (<Outer {...outerProps}>- <AnimatedSAV+ <SafeAreaViewstyle={{width: width > 500 ? 500 : width,height: height - kh,- opacity: Platform.OS !== 'ios' ? opacity : 1,alignSelf: 'center',justifyContent: 'flex-end'}}@@ -495,7 +469,6 @@ const NotesnookShare = ({ quicknote = false }) => {if (showSearch) {console.log('hide search');setShowSearch(false);- animate(1, 0);} else {close();}@@ -538,7 +511,6 @@ const NotesnookShare = ({ quicknote = false }) => {if (showSearch) {console.log('hide search');setShowSearch(false);- animate(1, 0);} else {close();}@@ -567,7 +539,6 @@ const NotesnookShare = ({ quicknote = false }) => {getKeyboardHeight={() => keyboardHeight.current}close={() => {setShowSearch(false);- animate(1, 0);}}/>) : null}@@ -625,7 +596,6 @@ const NotesnookShare = ({ quicknote = false }) => {color={colors.nav}onPress={() => {setShowSearch(true);- animate(1, 1000);}}icon="text-short"iconSize={18}@@ -793,7 +763,7 @@ const NotesnookShare = ({ quicknote = false }) => {/></View></View>- </AnimatedSAV>+ </SafeAreaView></Outer>);};diff --git a/apps/mobile/src/components/container/floatingbutton.js b/apps/mobile/src/components/container/floatingbutton.jsindex 8351ed60f..51e2c68b3 100644--- a/apps/mobile/src/components/container/floatingbutton.js+++ b/apps/mobile/src/components/container/floatingbutton.js@@ -1,6 +1,11 @@import React, { useEffect } from 'react';import { Keyboard, Platform, View } from 'react-native';-import Animated, { EasingNode } from 'react-native-reanimated';+import Animated, {+ Easing,+ useAnimatedStyle,+ useSharedValue,+ withTiming+} from 'react-native-reanimated';import { useSafeAreaInsets } from 'react-native-safe-area-context';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import { notesnook } from '../../../e2e/test.ids';@@ -14,17 +19,30 @@ export const FloatingButton = ({ title, onPress, color = 'accent', shouldShow =const insets = useSafeAreaInsets();const deviceMode = useSettingStore(state => state.deviceMode);const selectionMode = useSelectionStore(state => state.selectionMode);+ const translate = useSharedValue(0);++ const animatedStyle = useAnimatedStyle(() => {+ return {+ transform: [+ {+ translateX: translate.value+ },+ {+ translateY: translate.value+ }+ ]+ };+ });useEffect(() => {animate(selectionMode ? 150 : 0);}, [selectionMode]);- function animate(translate) {- Animated.timing(translateY, {- toValue: translate,+ function animate(toValue) {+ translate.value = withTiming(toValue, {duration: 250,- easing: EasingNode.elastic(1)- }).start();+ easing: Easing.elastic(1)+ });}const onKeyboardHide = async () => {@@ -50,25 +68,20 @@ export const FloatingButton = ({ title, onPress, color = 'accent', shouldShow =return deviceMode !== 'mobile' && !shouldShow ? null : (<Animated.View- style={{- position: 'absolute',- right: 12,- bottom:- Platform.OS === 'ios' && insets.bottom !== 0- ? Platform.isPad- ? insets.bottom - 12- : insets.bottom - 24- : insets.bottom + 12,- zIndex: 10,- transform: [- {- translateY: translateY- },- {- translateX: translateY- }- ]- }}+ style={[+ {+ position: 'absolute',+ right: 12,+ bottom:+ Platform.OS === 'ios' && insets.bottom !== 0+ ? Platform.isPad+ ? insets.bottom - 12+ : insets.bottom - 24+ : insets.bottom + 12,+ zIndex: 10+ },+ animatedStyle+ ]}><PressableButtontestID={notesnook.buttons.add}diff --git a/apps/mobile/src/components/intro/index.js b/apps/mobile/src/components/intro/index.jsindex c7a9a3023..0eb515dca 100644--- a/apps/mobile/src/components/intro/index.js+++ b/apps/mobile/src/components/intro/index.js@@ -1,17 +1,16 @@import React, { useEffect } from 'react';import { Dimensions, Image, TouchableOpacity, useWindowDimensions, View } from 'react-native';-import Animated, { EasingNode, timing, useValue } from 'react-native-reanimated';-import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';+import Animated, { FadeIn } from 'react-native-reanimated';+import { SafeAreaView } from 'react-native-safe-area-context';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import { useThemeStore } from '../../stores/theme';-import { useSettingStore } from '../../stores/stores';+import AppLock from '../../screens/settings/app-lock';import SettingsService from '../../services/settings';+import { useSettingStore } from '../../stores/stores';+import { useThemeStore } from '../../stores/theme';import { getElevation } from '../../utils';import umami from '../../utils/analytics';-import { MMKV } from '../../utils/database/mmkv';import { SIZE } from '../../utils/size';import { sleep } from '../../utils/time';-import AppLock from '../../screens/settings/app-lock';import { Button } from '../ui/button';import { SvgView } from '../ui/svg';import { BouncingView } from '../ui/transitions/bouncing-view';@@ -29,26 +28,9 @@ const Intro = () => {const isTelemetryEnabled = useSettingStore(state => state.settings.telemetry);const { height } = useWindowDimensions();- const opacity = useValue(0);- const translateY = useValue(5);- const translateY2 = useValue(0);- const insets = useSafeAreaInsets();-useEffect(() => {if (!introCompleted) {umami.pageView('/welcome', '', []);- setTimeout(() => {- timing(opacity, {- toValue: 1,- duration: 600,- easing: EasingNode.in(EasingNode.ease)- }).start();- timing(translateY, {- toValue: 0,- duration: 1000,- easing: EasingNode.in(EasingNode.ease)- }).start();- }, 15);}}, [introCompleted]);@@ -60,19 +42,14 @@ const Intro = () => {return (!introCompleted && (- <Animated.View+ <ViewtestID="notesnook.splashscreen"style={{zIndex: 999,width: '100%',height: '100%',position: 'absolute',- backgroundColor: colors.bg,- transform: [- {- translateY: translateY2- }- ]+ backgroundColor: colors.bg}}><SafeAreaView@@ -85,17 +62,12 @@ const Intro = () => {}}><Animated.View+ layout={FadeIn.duration(500)}style={{width: '100%',height: '100%',justifyContent: 'center',- alignItems: 'center',- opacity: opacity,- transform: [- {- translateY: translateY- }- ]+ alignItems: 'center'}}><Image@@ -218,7 +190,7 @@ const Intro = () => {</BouncingView></Animated.View></SafeAreaView>- </Animated.View>+ </View>));};diff --git a/apps/mobile/src/components/list/card.js b/apps/mobile/src/components/list/card.jsindex b06d630ba..2eb52b0a2 100644--- a/apps/mobile/src/components/list/card.js+++ b/apps/mobile/src/components/list/card.js@@ -1,8 +1,9 @@import React from 'react';import { View } from 'react-native';+import Animated, { FadeInUp, FadeOutUp } from 'react-native-reanimated';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import { useThemeStore } from '../../stores/theme';import { useMessageStore, useSelectionStore } from '../../stores/stores';+import { useThemeStore } from '../../stores/theme';import { hexToRGBA } from '../../utils/color-scheme/utils';import { SIZE } from '../../utils/size';import { PressableButton } from '../ui/pressable';@@ -17,74 +18,82 @@ export const Card = ({ color, warning }) => {const announcement = useMessageStore(state => state.announcement);return !messageBoardState.visible || selectionMode || announcement || warning ? null : (- <PressableButton- onPress={messageBoardState.onPress}- type="gray"- customStyle={{- paddingVertical: 12,- width: '95%',- flexDirection: 'row',- alignItems: 'center',- justifyContent: 'flex-start',- paddingHorizontal: 0+ <Animated.View+ style={{+ width: '95%'}}+ entering={FadeInUp}+ exiting={FadeOutUp}>- <View- style={{- width: 40,- backgroundColor:- messageBoardState.type === 'error'- ? hexToRGBA(colors.red, 0.15)- : hexToRGBA(color, 0.15),- height: 40,- marginLeft: 10,- borderRadius: 100,+ <PressableButton+ onPress={messageBoardState.onPress}+ type="gray"+ customStyle={{+ paddingVertical: 12,+ width: '95%',+ flexDirection: 'row',alignItems: 'center',- justifyContent: 'center'+ justifyContent: 'flex-start',+ paddingHorizontal: 0}}>- <Icon- size={SIZE.lg}- color={messageBoardState.type === 'error' ? colors.errorText : color}- name={messageBoardState.icon}- />- </View>+ <View+ style={{+ width: 40,+ backgroundColor:+ messageBoardState.type === 'error'+ ? hexToRGBA(colors.red, 0.15)+ : hexToRGBA(color, 0.15),+ height: 40,+ marginLeft: 10,+ borderRadius: 100,+ alignItems: 'center',+ justifyContent: 'center'+ }}+ >+ <Icon+ size={SIZE.lg}+ color={messageBoardState.type === 'error' ? colors.errorText : color}+ name={messageBoardState.icon}+ />+ </View>- <View- style={{- marginLeft: 10,- maxWidth: '70%'- }}- >- <Paragraph color={colors.icon} size={SIZE.xs}>- {messageBoardState.message}- </Paragraph>- <Paragraph+ <Viewstyle={{- maxWidth: '100%'+ marginLeft: 10,+ maxWidth: '70%'}}- color={colors.heading}>- {messageBoardState.actionText}- </Paragraph>- </View>+ <Paragraph color={colors.icon} size={SIZE.xs}>+ {messageBoardState.message}+ </Paragraph>+ <Paragraph+ style={{+ maxWidth: '100%'+ }}+ color={colors.heading}+ >+ {messageBoardState.actionText}+ </Paragraph>+ </View>- <View- style={{- width: 40,- height: 40,- justifyContent: 'center',- alignItems: 'center',- position: 'absolute',- right: 6- }}- >- <Icon- name="chevron-right"- color={messageBoardState.type === 'error' ? colors.red : color}- size={SIZE.lg}- />- </View>- </PressableButton>+ <View+ style={{+ width: 40,+ height: 40,+ justifyContent: 'center',+ alignItems: 'center',+ position: 'absolute',+ right: 6+ }}+ >+ <Icon+ name="chevron-right"+ color={messageBoardState.type === 'error' ? colors.red : color}+ size={SIZE.lg}+ />+ </View>+ </PressableButton>+ </Animated.View>);};diff --git a/apps/mobile/src/components/list/index.js b/apps/mobile/src/components/list/index.jsindex 1cef1e31a..e5f501e41 100644--- a/apps/mobile/src/components/list/index.js+++ b/apps/mobile/src/components/list/index.js@@ -1,21 +1,21 @@import React, { useEffect, useRef, useState } from 'react';import { FlatList, RefreshControl, View } from 'react-native';import { notesnook } from '../../../e2e/test.ids';-import { useThemeStore } from '../../stores/theme';-import { useUserStore } from '../../stores/stores';import { eSendEvent } from '../../services/event-manager';import Sync from '../../services/sync';+import { useUserStore } from '../../stores/stores';+import { useThemeStore } from '../../stores/theme';import { db } from '../../utils/database';import { eScrollEvent } from '../../utils/events';+import { tabBarRef } from '../../utils/global-refs';import JumpToSectionDialog from '../dialogs/jump-to-section';-import { NotebookWrapper } from '../list-items/notebook/wrapper';-import { NoteWrapper } from '../list-items/note/wrapper';-import TagItem from '../list-items/tag';-import { Empty } from './empty';import { Footer } from '../list-items/footer';import { Header } from '../list-items/headers/header';import { SectionHeader } from '../list-items/headers/section-header';-import { tabBarRef } from '../../utils/global-refs';+import { NoteWrapper } from '../list-items/note/wrapper';+import { NotebookWrapper } from '../list-items/notebook/wrapper';+import TagItem from '../list-items/tag';+import { Empty } from './empty';const renderItems = {note: NoteWrapper,diff --git a/apps/mobile/src/components/listitems/selectionwrapper/actionstrip.js b/apps/mobile/src/components/listitems/selectionwrapper/actionstrip.jsindex 6112bbcc8..196f5bd12 100644--- a/apps/mobile/src/components/listitems/selectionwrapper/actionstrip.js+++ b/apps/mobile/src/components/listitems/selectionwrapper/actionstrip.js@@ -1,22 +1,22 @@+import Clipboard from '@react-native-clipboard/clipboard';import React, { useEffect, useState } from 'react';import { View } from 'react-native';-import Clipboard from '@react-native-clipboard/clipboard';-import Animated, { useValue } from 'react-native-reanimated';-import { useThemeStore } from '../../../stores/theme';+import Animated, { SlideInUp, SlideOutDown, useValue } from 'react-native-reanimated';+import { openVault, ToastEvent } from '../../../services/event-manager';+import Navigation from '../../../services/navigation';import {useMenuStore,useNotebookStore,useSelectionStore,useTrashStore} from '../../../stores/stores';-import { openVault, ToastEvent } from '../../../services/event-manager';-import Navigation from '../../../services/navigation';+import { useThemeStore } from '../../../stores/theme';import { dWidth, getElevation, toTXT } from '../../../utils';import { db } from '../../../utils/database';import { deleteItems } from '../../../utils/functions';-import { IconButton } from '../../ui/icon-button';-import { Button } from '../../ui/button';import { presentDialog } from '../../dialog/functions';+import { Button } from '../../ui/button';+import { IconButton } from '../../ui/icon-button';export const ActionStrip = ({ note, setActionStrip }) => {const colors = useThemeStore(state => state.colors);@@ -42,15 +42,6 @@ export const ActionStrip = ({ note, setActionStrip }) => {]);};- useEffect(() => {- setTimeout(() => {- opacity.setValue(1);- }, 100);- return () => {- opacity.setValue(0);- };- }, [width]);-const actions = [{title: 'Pin ' + note.type,@@ -233,15 +224,16 @@ export const ActionStrip = ({ note, setActionStrip }) => {onLayout={event => {setWidth(event.nativeEvent.layout.width);}}+ entering={SlideInUp.springify().mass(0.4)}+ exiting={SlideOutDown}style={{position: 'absolute',- zIndex: 20,+ zIndex: 999,width: '102%',height: '100%',flexDirection: 'row',justifyContent: 'flex-end',- alignItems: 'center',- opacity: opacity+ alignItems: 'center'}}><Buttondiff --git a/apps/mobile/src/components/listitems/selectionwrapper/index.js b/apps/mobile/src/components/listitems/selectionwrapper/index.jsindex 01af2b410..0850d0416 100644--- a/apps/mobile/src/components/listitems/selectionwrapper/index.js+++ b/apps/mobile/src/components/listitems/selectionwrapper/index.js@@ -1,7 +1,7 @@import React, { useEffect, useState } from 'react';-import { useThemeStore } from '../../../stores/theme';-import { useSettingStore } from '../../../stores/stores';import { eSubscribeEvent, eUnSubscribeEvent } from '../../../services/event-manager';+import { useSettingStore } from '../../../stores/stores';+import { useThemeStore } from '../../../stores/theme';import { history } from '../../../utils';import { PressableButton } from '../../ui/pressable';import { ActionStrip } from './action-strip';@@ -61,8 +61,6 @@ const SelectionWrapper = ({ children, item, background, onLongPress, onPress, tepaddingVertical: compactMode ? 8 : 12}}>- {actionStrip ? <ActionStrip note={item} setActionStrip={setActionStrip} /> : null}-{item.type === 'note' ? <Filler background={background} item={item} /> : null}<SelectionIconcompactMode={compactMode}@@ -71,6 +69,8 @@ const SelectionWrapper = ({ children, item, background, onLongPress, onPress, teonLongPress={onLongPress}/>{children}++ {actionStrip ? <ActionStrip note={item} setActionStrip={setActionStrip} /> : null}</PressableButton>);};diff --git a/apps/mobile/src/components/premium/premiumtoast.js b/apps/mobile/src/components/premium/premiumtoast.jsindex cc260979e..15ef26a91 100644--- a/apps/mobile/src/components/premium/premiumtoast.js+++ b/apps/mobile/src/components/premium/premiumtoast.js@@ -1,84 +1,40 @@-import React, { useEffect, useState } from 'react';+import React, { useEffect, useRef, useState } from 'react';import { View } from 'react-native';-import Animated, { EasingNode } from 'react-native-reanimated';-import { useThemeStore } from '../../stores/theme';+import Animated, { FadeInUp, FadeOutUp } from 'react-native-reanimated';+import { EditorWebView } from '../../screens/editor/Functions';+import tiny from '../../screens/editor/tiny/tiny';import { DDS } from '../../services/device-detection';import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/event-manager';-import { dWidth, editing, getElevation } from '../../utils';+import { useThemeStore } from '../../stores/theme';+import { editing, getElevation } from '../../utils';import { eCloseActionSheet, eOpenPremiumDialog, eShowGetPremium } from '../../utils/events';import { SIZE } from '../../utils/size';import { sleep } from '../../utils/time';-import { EditorWebView } from '../../screens/editor/Functions';-import tiny from '../../screens/editor/tiny/tiny';import { Button } from '../ui/button';import Heading from '../ui/typography/heading';import Paragraph from '../ui/typography/paragraph';-export const translatePrem = new Animated.Value(-dWidth);-export const opacityPrem = new Animated.Value(0);-let timer = null;-let currentMsg = {- title: '',- desc: ''-};export const PremiumToast = ({ close, context = 'global', offset = 0 }) => {const colors = useThemeStore(state => state.colors);- const [msg, setMsg] = useState(currentMsg);+ const [msg, setMsg] = useState(null);+ const timer = useRef();const open = event => {if (!event) {- if (timer !== null) {- clearTimeout(timer);- timer = null;- }- currentMsg = {- title: '',- desc: ''- };- setMsg(currentMsg);- opacityPrem.setValue(0);- translatePrem.setValue(-dWidth);+ clearTimeout(timer);+ timer.current = null;+ setMsg(null);return;}- if (event.context === context && currentMsg?.desc !== event.desc) {- if (timer !== null) {- clearTimeout(timer);- timer = null;+ if (event.context === context && msg?.desc !== event.desc) {+ if (timer.current !== null) {+ clearTimeout(timer.current);+ timer.current = null;}- opacityPrem.setValue(0);- translatePrem.setValue(-dWidth);- currentMsg = {- title: event.title,- desc: event.desc- };- setMsg(currentMsg);- opacityPrem.setValue(1);- Animated.timing(opacityPrem, {- toValue: 1,- duration: 300,- easing: EasingNode.inOut(EasingNode.ease)- }).start();- Animated.timing(translatePrem, {- toValue: 0,- duration: 300,- easing: EasingNode.inOut(EasingNode.ease)- }).start();-- let timer = setTimeout(async () => {- Animated.timing(opacityPrem, {- toValue: -0,- duration: 150,- easing: EasingNode.inOut(EasingNode.ease)- }).start();- currentMsg = {- title: '',- desc: ''- };- await sleep(150);- setMsg(currentMsg);- opacityPrem.setValue(0);- translatePrem.setValue(-dWidth);+ setMsg(event);+ timer.current = setTimeout(async () => {+ setMsg(null);}, 3000);}};@@ -86,7 +42,7 @@ export const PremiumToast = ({ close, context = 'global', offset = 0 }) => {useEffect(() => {eSubscribeEvent(eShowGetPremium, open);return () => {- translatePrem.setValue(-dWidth);+ clearTimeout(timer.current);eUnSubscribeEvent(eShowGetPremium, open);};}, []);@@ -102,56 +58,54 @@ export const PremiumToast = ({ close, context = 'global', offset = 0 }) => {};return (- <Animated.View- style={{- position: 'absolute',- backgroundColor: colors.nav,- zIndex: 999,- ...getElevation(10),- padding: 12,- borderRadius: 10,- flexDirection: 'row',- alignSelf: 'center',- justifyContent: 'space-between',- top: offset,- opacity: opacityPrem,- maxWidth: DDS.isLargeTablet() ? 400 : '98%',- transform: [- {- translateY: translatePrem- }- ]- }}- >- <View+ !!msg && (+ <Animated.View+ entering={FadeInUp}+ exiting={FadeOutUp}style={{- flexShrink: 1,- flexGrow: 1,- paddingRight: 6+ position: 'absolute',+ backgroundColor: colors.nav,+ zIndex: 999,+ ...getElevation(20),+ padding: 12,+ borderRadius: 10,+ flexDirection: 'row',+ alignSelf: 'center',+ justifyContent: 'space-between',+ top: offset,+ maxWidth: DDS.isLargeTablet() ? 400 : '98%'}}>- <Heading+ <Viewstyle={{- flexWrap: 'wrap'+ flexShrink: 1,+ flexGrow: 1,+ paddingRight: 6}}- color={colors.accent}- size={SIZE.md}>- {msg.title}- </Heading>+ <Heading+ style={{+ flexWrap: 'wrap'+ }}+ color={colors.accent}+ size={SIZE.md}+ >+ {msg.title}+ </Heading>- <Paragraph- style={{- flexWrap: 'wrap'- }}- size={SIZE.sm}- color={colors.pri}- >- {msg.desc}- </Paragraph>- </View>+ <Paragraph+ style={{+ flexWrap: 'wrap'+ }}+ size={SIZE.sm}+ color={colors.pri}+ >+ {msg.desc}+ </Paragraph>+ </View>- <Button onPress={onPress} title="Get Now" type="accent" />- </Animated.View>+ <Button onPress={onPress} title="Get Now" type="accent" />+ </Animated.View>+ ));};diff --git a/apps/mobile/src/components/sheets/sort/index.js b/apps/mobile/src/components/sheets/sort/index.jsindex 7698d8614..27399cd5f 100644--- a/apps/mobile/src/components/sheets/sort/index.js+++ b/apps/mobile/src/components/sheets/sort/index.js@@ -11,6 +11,7 @@ import { SIZE } from '../../../utils/size';import { Button } from '../../ui/button';import Seperator from '../../ui/seperator';import Heading from '../../ui/typography/heading';+import Animated, { Layout } from 'react-native-reanimated';const Sort = ({ type, screen }) => {const colors = useThemeStore(state => state.colors);@@ -106,7 +107,7 @@ const Sort = ({ type, screen }) => {<Buttontype={'grayBg'}title="Title"- height={45}+ height={40}iconPosition="left"icon={'check'}buttonType={{ text: colors.accent }}diff --git a/apps/mobile/src/components/tabs/index.js b/apps/mobile/src/components/tabs/index.jsindex f6d71e7ac..9a72747da 100644--- a/apps/mobile/src/components/tabs/index.js+++ b/apps/mobile/src/components/tabs/index.js@@ -37,7 +37,7 @@ export default class Tabs extends Component {let page0Width = pOffset - aOffset;if (- (this.page === 0 && !this.currentDrawerState && x > 80 && x < page0Width - 80) ||+ (this.page === 0 && !this.currentDrawerState && x > 100 && x < page0Width - 100) ||DDS.isLargeTablet()) {this.responderAllowedScroll = false;diff --git a/apps/mobile/src/components/ui/button/index.tsx b/apps/mobile/src/components/ui/button/index.tsxindex c33116efd..e35287660 100644--- a/apps/mobile/src/components/ui/button/index.tsx+++ b/apps/mobile/src/components/ui/button/index.tsx@@ -1,5 +1,14 @@import React from 'react';import { ActivityIndicator, ColorValue, TextStyle } from 'react-native';+import Animated, {+ FadeIn,+ FadeOut,+ Layout,+ LightSpeedInLeft,+ SlideInLeft,+ SlideInRight,+ SlideOutLeft+} from 'react-native-reanimated';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import { useThemeStore } from '../../../stores/theme';import { showTooltip, TOOLTIP_POSITIONS } from '../../../utils';@@ -9,6 +18,8 @@ import { PressableButton, PressableButtonProps } from '../pressable';import Heading from '../typography/heading';import Paragraph from '../typography/paragraph';+const AnimatedIcon = Animated.createAnimatedComponent(Icon);+interface ButtonProps extends PressableButtonProps {height?: number;icon?: string;@@ -66,79 +77,85 @@ export const Button = ({const Component = bold ? Heading : Paragraph;return (- <PressableButton- {...restProps}- fwdRef={fwdRef}- onPress={onPress}- onLongPress={event => {- if (onLongPress) {- onLongPress(event);- return;- }- if (tooltipText) {- showTooltip(event, tooltipText, TOOLTIP_POSITIONS.TOP);- }- }}- disabled={loading}- type={type}- accentColor={accentColor}- accentText={accentText}- customColor={buttonType?.color}- customSelectedColor={buttonType?.selected}- customOpacity={buttonType?.opacity}- customAlpha={buttonType?.alpha}- customStyle={{- height: height,- width: width || null,- paddingHorizontal: 12,- borderRadius: 5,- alignSelf: 'center',- justifyContent: 'center',- alignItems: 'center',- flexDirection: 'row',- //@ts-ignore- ...style- }}- >- {loading ? <ActivityIndicator color={textColor} size={fontSize + 4} /> : null}- {icon && !loading && iconPosition === 'left' ? (- <Icon- name={icon}- style={{- marginRight: 0- }}- color={iconColor || buttonType?.text || textColor}- size={iconSize}- />- ) : null}+ <Animated.View entering={FadeIn} exiting={FadeOut} layout={Layout.springify()}>+ <PressableButton+ {...restProps}+ fwdRef={fwdRef}+ onPress={onPress}+ onLongPress={event => {+ if (onLongPress) {+ onLongPress(event);+ return;+ }+ if (tooltipText) {+ showTooltip(event, tooltipText, TOOLTIP_POSITIONS.TOP);+ }+ }}+ disabled={loading}+ type={type}+ accentColor={accentColor}+ accentText={accentText}+ customColor={buttonType?.color}+ customSelectedColor={buttonType?.selected}+ customOpacity={buttonType?.opacity}+ customAlpha={buttonType?.alpha}+ customStyle={{+ height: height,+ width: width || null,+ paddingHorizontal: 12,+ borderRadius: 5,+ alignSelf: 'center',+ justifyContent: 'center',+ alignItems: 'center',+ flexDirection: 'row',+ //@ts-ignore+ ...style+ }}+ >+ {loading ? <ActivityIndicator color={textColor} size={fontSize + 4} /> : null}+ {icon && !loading && iconPosition === 'left' ? (+ <AnimatedIcon+ exiting={FadeOut.duration(100)}+ entering={LightSpeedInLeft}+ layout={Layout.springify()}+ name={icon}+ style={{+ marginRight: 0+ }}+ color={iconColor || buttonType?.text || textColor}+ size={iconSize}+ />+ ) : null}- {!title ? null : (- <Component- color={textColor}- size={fontSize}- numberOfLines={1}- style={[- {- marginLeft: icon || (loading && iconPosition === 'left') ? 5 : 0,- marginRight: icon || (loading && iconPosition === 'right') ? 5 : 0- },- textStyle- ]}- >- {title}- </Component>- )}+ {!title ? null : (+ <Component+ layout={Layout}+ color={textColor}+ size={fontSize}+ numberOfLines={1}+ style={[+ {+ marginLeft: icon || (loading && iconPosition === 'left') ? 5 : 0,+ marginRight: icon || (loading && iconPosition === 'right') ? 5 : 0+ },+ textStyle+ ]}+ >+ {title}+ </Component>+ )}- {icon && !loading && iconPosition === 'right' ? (- <Icon- name={icon}- style={{- marginLeft: 0- }}- color={iconColor || buttonType?.text || textColor}- size={iconSize}- />- ) : null}- </PressableButton>+ {icon && !loading && iconPosition === 'right' ? (+ <Icon+ name={icon}+ style={{+ marginLeft: 0+ }}+ color={iconColor || buttonType?.text || textColor}+ size={iconSize}+ />+ ) : null}+ </PressableButton>+ </Animated.View>);};diff --git a/apps/mobile/src/components/ui/pressable/index.tsx b/apps/mobile/src/components/ui/pressable/index.tsxindex d783d1fab..ce4f30916 100644--- a/apps/mobile/src/components/ui/pressable/index.tsx+++ b/apps/mobile/src/components/ui/pressable/index.tsx@@ -4,8 +4,10 @@ import {Pressable,PressableProps,PressableStateCallbackType,+ View,ViewStyle} from 'react-native';+import Animated from 'react-native-reanimated';import { ThemeStore, useThemeStore } from '../../../stores/theme';import { hexToRGBA, RGB_Linear_Shade } from '../../../utils/color-scheme/utils';import { BUTTON_TYPES } from '../../../utils/constants';@@ -22,6 +24,7 @@ export interface PressableButtonProps extends PressableProps {customAlpha?: number;customOpacity?: number;fwdRef?: RefObject<any>;+ animatedViewProps?: Animated.AnimateProps<View>;}export const PressableButton = ({@@ -40,7 +43,8 @@ export const PressableButton = ({customSelectedColor,customAlpha,customOpacity,- fwdRef+ fwdRef,+ animatedViewProps}: PressableButtonProps) => {const colors = useThemeStore(state => state.colors);diff --git a/apps/mobile/src/components/ui/transitions/bouncingview.js b/apps/mobile/src/components/ui/transitions/bouncingview.jsindex fa8d8ef2e..57d3c0dad 100644--- a/apps/mobile/src/components/ui/transitions/bouncingview.js+++ b/apps/mobile/src/components/ui/transitions/bouncingview.js@@ -1,5 +1,10 @@-import React, { useEffect, useState } from 'react';-import Animated, { EasingNode, timing } from 'react-native-reanimated';+import React, { useEffect } from 'react';+import Animated, {+ Easing,+ useAnimatedStyle,+ useSharedValue,+ withTiming+} from 'react-native-reanimated';export const BouncingView = ({children,@@ -8,37 +13,30 @@ export const BouncingView = ({animated = true,initialScale = 0.9}) => {- const scale = Animated.useValue(!animated ? 1 : initialScale);+ const scale = useSharedValue(!animated ? 1 : initialScale);++ const animatedStyle = useAnimatedStyle(() => {+ return {+ transform: [+ {+ scale: !animated ? 1 : scale.value+ }+ ]+ };+ });useEffect(() => {if (!animated) return;- scale.setValue(initialScale);- timing(scale, {- toValue: 1,+ scale.value = initialScale;+ scale.value = withTiming(1, {duration: duration,- easing: EasingNode.elastic(1)- }).start();-+ easing: Easing.elastic(1)+ });return () => {if (!animated) return;- scale.setValue(initialScale);+ scale.value = initialScale;};}, []);- return (- <Animated.View- style={[- {- transform: [- {- scale: !animated ? 1 : scale- }- ]- },- style- ]}- >- {children}- </Animated.View>- );+ return <Animated.View style={[style, animatedStyle]}>{children}</Animated.View>;};diff --git a/apps/mobile/src/components/ui/transitions/movableview.js b/apps/mobile/src/components/ui/transitions/movableview.jsdeleted file mode 100644index 1b0a0fd6f..000000000--- a/apps/mobile/src/components/ui/transitions/movableview.js+++ /dev/null@@ -1,113 +0,0 @@-import React, { Component } from 'react';-import { PanResponder } from 'react-native';-import Animated, { EasingNode } from 'react-native-reanimated';--export default class MovableView extends Component {- constructor(props) {- super(props);- this.state = {- panY: new Animated.Value(0),- panX: new Animated.Value(0),- scale: new Animated.Value(1),- disabled: props.disabled,- xOffset: 0,- yOffset: 0- };-- this.panResponder = PanResponder.create({- onMoveShouldSetPanResponder: () => !this.state.disabled,- onMoveShouldSetPanResponderCapture: () => !this.state.disabled,- onPanResponderGrant: () => {- Animated.timing(this.state.scale, {- toValue: 1.03,- duration: 600,- easing: EasingNode.elastic(1)- }).start();- this.props.onDragStart();- },- onPanResponderMove: (event, state) => {- if (this.props.movable) {- this.state.panX.setValue(state.dx);- this.state.panY.setValue(state.dy);- }- },- onPanResponderRelease: () => {- Animated.timing(this.state.panX, {- toValue: 0,- duration: 600,- easing: EasingNode.elastic(1)- }).start();- Animated.timing(this.state.panY, {- toValue: 0,- duration: 600,- easing: EasingNode.elastic(1)- }).start();-- Animated.timing(this.state.scale, {- toValue: 1,- duration: 600,- easing: EasingNode.elastic(1)- }).start();-- this.xOffset = 0;- this.yOffset = 0;-- this.props.onDragEnd();- }- });- }-- componentDidMount() {- if (typeof this.props.onMove === 'function')- this.state.pan.addListener(values => this.props.onMove(values));- if (this.props.breath) {- let value = 0;- setInterval(() => {- value = value === 1 ? 1.03 : 1;- Animated.timing(this.state.scale, {- toValue: value,- duration: this.props.breathDuration | 1000,- easing: EasingNode.inOut(EasingNode.ease)- }).start();- }, 1000);- }- }-- changeDisableStatus = () => {- this.setState({- disabled: !this.state.disabled- });- };-- render() {- return (- <Animated.View- {...this.panResponder.panHandlers}- style={[- this.props.style,- {- transform: [- {- scale: this.state.scale- },- {- translateX: this.state.panX- },- {- translateY: this.state.panY- }- ]- }- ]}- >- {this.props.children}- </Animated.View>- );- }-}--MovableView.defaultProps = {- onDragStart: () => {},- onDragEnd: () => {},- disabled: false-};diff --git a/apps/mobile/src/components/ui/typography/heading.tsx b/apps/mobile/src/components/ui/typography/heading.tsxindex 027e4a0ed..6a77c7973 100644--- a/apps/mobile/src/components/ui/typography/heading.tsx+++ b/apps/mobile/src/components/ui/typography/heading.tsx@@ -1,19 +1,24 @@import React from 'react';import { Platform, TextProps } from 'react-native';import { Text } from 'react-native';+import Animated, { ComplexAnimationBuilder, Layout } from 'react-native-reanimated';import { useThemeStore } from '../../../stores/theme';import { SIZE } from '../../../utils/size';interface HeadingProps extends TextProps {color?: string;size?: number;+ layout?: ComplexAnimationBuilder;}+const AnimatedText = Animated.createAnimatedComponent(Text);+const Heading = ({ color, size = SIZE.xl, style, ...restProps }: HeadingProps) => {const colors = useThemeStore(state => state.colors);return (- <Text+ <AnimatedText+ layout={restProps.layout || Layout}allowFontScaling={true}maxFontSizeMultiplier={1}{...restProps}@@ -26,7 +31,7 @@ const Heading = ({ color, size = SIZE.xl, style, ...restProps }: HeadingProps) =},style]}- ></Text>+ ></AnimatedText>);};diff --git a/apps/mobile/src/components/ui/typography/paragraph.tsx b/apps/mobile/src/components/ui/typography/paragraph.tsxindex e1a4ebec4..2f02f2b2d 100644--- a/apps/mobile/src/components/ui/typography/paragraph.tsx+++ b/apps/mobile/src/components/ui/typography/paragraph.tsx@@ -1,18 +1,22 @@import React from 'react';import { Text, TextProps } from 'react-native';+import Animated, { ComplexAnimationBuilder, Layout } from 'react-native-reanimated';import { useThemeStore } from '../../../stores/theme';import { SIZE } from '../../../utils/size';interface ParagraphProps extends TextProps {color?: string;size?: number;+ layout?: ComplexAnimationBuilder;}+const AnimatedText = Animated.createAnimatedComponent(Text);const Paragraph = ({ color, size = SIZE.sm, style, ...restProps }: ParagraphProps) => {const colors = useThemeStore(state => state.colors);return (- <Text+ <AnimatedText+ layout={restProps.layout || Layout}allowFontScalingmaxFontSizeMultiplier={1}{...restProps}@@ -25,7 +29,7 @@ const Paragraph = ({ color, size = SIZE.sm, style, ...restProps }: ParagraphProp},style]}- ></Text>+ ></AnimatedText>);};diff --git a/apps/mobile/src/screens/editor/EditorOverlay.js b/apps/mobile/src/screens/editor/EditorOverlay.jsindex 5dd7ea204..354f4bf01 100644--- a/apps/mobile/src/screens/editor/EditorOverlay.js+++ b/apps/mobile/src/screens/editor/EditorOverlay.js@@ -1,15 +1,15 @@import React, { useEffect, useState } from 'react';import { View } from 'react-native';-import Animated, { EasingNode, timing, useValue } from 'react-native-reanimated';+import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';import { Button } from '../../components/ui/button';import Heading from '../../components/ui/typography/heading';import Paragraph from '../../components/ui/typography/paragraph';-import { useThemeStore } from '../../stores/theme';import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/event-manager';+import { useThemeStore } from '../../stores/theme';import { editing } from '../../utils';import { eOnLoadNote } from '../../utils/events';import { SIZE } from '../../utils/size';-import { sleep, timeConverter } from '../../utils/time';+import { timeConverter } from '../../utils/time';let timer = null;let timerError = null;@@ -18,7 +18,13 @@ const EditorOverlay = () => {const colors = useThemeStore(state => state.colors);const [loading, setLoading] = useState(null);const [error, setError] = useState(false);- const opacity = useValue(1);+ const opacity = useSharedValue(1);++ const animatedStyle = useAnimatedStyle(() => {+ return {+ opacity: opacity.value+ };+ });const load = async _loading => {editing.overlay = true;@@ -26,11 +32,10 @@ const EditorOverlay = () => {clearTimeout(timerError);clearTimeout(timerClosing);if (_loading) {- opacity.setValue(1);+ opacity.value = 1;setLoading(_loading);timerError = setTimeout(() => {if (_loading) {- console.log('could not load');let _n = _loading;_n.forced = true;eSendEvent(eOnLoadNote, _n);@@ -43,18 +48,19 @@ const EditorOverlay = () => {clearTimeout(timerClosing);setError(false);editing.overlay = false;- timing(opacity, {- toValue: 0,- duration: 150,- easing: EasingNode.in(EasingNode.ease)- }).start();+ opacity.value = withTiming(0, { duration: 150 });timerClosing = setTimeout(() => {- opacity.setValue(1);setLoading(null);}, 150);}};+ useEffect(() => {+ if (!loading) {+ opacity.value = 1;+ }+ }, [loading]);+useEffect(() => {eSubscribeEvent('loadingNote', load);return () => {@@ -64,21 +70,23 @@ const EditorOverlay = () => {return (<Animated.View- style={{- position: 'absolute',- width: '100%',- height: '100%',- backgroundColor: colors.bg,- justifyContent: 'center',- alignItems: 'center',- opacity: opacity,- transform: [- {- translateY: loading ? 0 : 6000- }- ],- zIndex: 100- }}+ style={[+ {+ position: 'absolute',+ width: '100%',+ height: '100%',+ backgroundColor: colors.bg,+ justifyContent: 'center',+ alignItems: 'center',+ transform: [+ {+ translateY: loading ? 0 : 6000+ }+ ],+ zIndex: 100+ },+ animatedStyle+ ]}><Animated.Viewstyle={{diff --git a/apps/mobile/src/screens/editor/EditorTitle.js b/apps/mobile/src/screens/editor/EditorTitle.jsindex f5855a437..334935295 100644--- a/apps/mobile/src/screens/editor/EditorTitle.js+++ b/apps/mobile/src/screens/editor/EditorTitle.js@@ -1,36 +1,21 @@import React, { useEffect, useState } from 'react';import { TextInput } from 'react-native';-import Animated, { EasingNode } from 'react-native-reanimated';-import { useThemeStore } from '../../stores/theme';+import Animated, { FadeInUp, FadeOutUp } from 'react-native-reanimated';import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/event-manager';+import { useThemeStore } from '../../stores/theme';import { SIZE } from '../../utils/size';-import { sleep } from '../../utils/time';import { post, _onMessage } from './Functions';-const opacityVal = new Animated.Value(0);-const translateY = new Animated.Value(-700);-function animation(v) {- Animated.timing(opacityVal, {- toValue: v,- duration: 150,- easing: EasingNode.inOut(EasingNode.ease)- }).start();-}-export const EditorTitle = () => {const colors = useThemeStore(state => state.colors);-const [title, setTitle] = useState(null);+ const [show, setShow] = useState(false);const onScroll = async data => {if (data.visible === undefined || data.visible === null) return;if (data.visible > 190) {- translateY.setValue(0);- await sleep(5);- animation(1);+ setShow(true);} else {- animation(0);- await sleep(150);- translateY.setValue(-700);+ setShow(false);}if (title !== data.title) {setTitle(data.title);@@ -44,16 +29,12 @@ export const EditorTitle = () => {};}, []);- return (+ return show ? (<Animated.View+ entering={FadeInUp}+ exiting={FadeOutUp}style={{- opacity: opacityVal,- paddingLeft: 0,- transform: [- {- translateY: translateY- }- ]+ paddingLeft: 0}}><TextInput@@ -82,5 +63,7 @@ export const EditorTitle = () => {}}/></Animated.View>+ ) : (+ <View />);};diff --git a/apps/mobile/src/screens/editor/tiny/toolbar/itempin.js b/apps/mobile/src/screens/editor/tiny/toolbar/itempin.jsindex 2429a52b2..0b2422ed7 100644--- a/apps/mobile/src/screens/editor/tiny/toolbar/itempin.js+++ b/apps/mobile/src/screens/editor/tiny/toolbar/itempin.js@@ -1,13 +1,19 @@import React, { useEffect, useState } from 'react';-import Animated, { EasingNode, timing, useValue } from 'react-native-reanimated';-import { useThemeStore } from '../../../../stores/theme';+import Animated, {+ Easing,+ useAnimatedStyle,+ useSharedValue,+ withTiming+} from 'react-native-reanimated';import { eSubscribeEvent, eUnSubscribeEvent } from '../../../../services/event-manager';+import { useThemeStore } from '../../../../stores/theme';import { sleep } from '../../../../utils/time';const ToolbarItemPin = ({ format, color }) => {const colors = useThemeStore(state => state.colors);const [visible, setVisible] = useState(false);- let scale = useValue(0);+ let scale = useSharedValue(0);+useEffect(() => {eSubscribeEvent('showTooltip', show);return () => {@@ -19,11 +25,10 @@ const ToolbarItemPin = ({ format, color }) => {async function animate(val, time = 200) {if (animating) return;animating = true;- timing(scale, {- toValue: val,+ scale.value = withTiming(val, {duration: time,- easing: EasingNode.in(EasingNode.ease)- }).start();+ easing: Easing.in(Easing.ease)+ });await sleep(time);animating = false;}@@ -40,21 +45,29 @@ const ToolbarItemPin = ({ format, color }) => {}};+ const animatedStyle = useAnimatedStyle(() => {+ return {+ transform: [+ {+ scale: scale.value+ }+ ]+ };+ }, []);+return (visible && (<Animated.View- style={{- width: '100%',- height: 3,- backgroundColor: color || colors.accent,- position: 'absolute',- top: 0,- transform: [- {- scale: scale- }- ]- }}+ style={[+ {+ width: '100%',+ height: 3,+ backgroundColor: color || colors.accent,+ position: 'absolute',+ top: 0+ },+ animatedStyle+ ]}/>));diff --git a/apps/mobile/src/screens/settings/subscription.js b/apps/mobile/src/screens/settings/subscription.jsindex 4acae9342..5ba872b2a 100644--- a/apps/mobile/src/screens/settings/subscription.js+++ b/apps/mobile/src/screens/settings/subscription.js@@ -4,20 +4,20 @@ import { Button } from '../../components/ui/button';import { eSendEvent, presentSheet, ToastEvent } from '../../services/event-manager';import PremiumService from '../../services/premium';import { useUserStore } from '../../stores/stores';-import { useThemeStore } from '../../stores/theme';import { SUBSCRIPTION_PROVIDER, SUBSCRIPTION_STATUS } from '../../utils/constants';import { eOpenPremiumDialog } from '../../utils/events';import { usePricing } from '../../utils/hooks/use-pricing';import { SIZE } from '../../utils/size';export const Subscription = () => {- const user: any = useUserStore(state => state.user);+ const user = useUserStore(state => state.user);const monthlyPlan = usePricing('monthly');- const colors = useThemeStore(state => state.colors);const isNotPro =user.subscription?.type !== SUBSCRIPTION_STATUS.PREMIUM &&user.subscription?.type !== SUBSCRIPTION_STATUS.BETA;+ const subscriptionProviderInfo = SUBSCRIPTION_PROVIDER[user?.subscription?.provider];+const manageSubscription = () => {if (!user.isEmailConfirmed) {PremiumService.showVerifyEmailDialog();@@ -77,28 +77,24 @@ export const Subscription = () => {/>) : null}- {user?.subscription?.provider &&+ {subscriptionProviderInfo &&user.subscription?.type !== SUBSCRIPTION_STATUS.PREMIUM_EXPIRED &&- user.subscription?.type !== SUBSCRIPTION_STATUS.BASIC &&- SUBSCRIPTION_PROVIDER[user?.subscription?.provider] ? (+ user.subscription?.type !== SUBSCRIPTION_STATUS.BASIC ? (<Button- title={SUBSCRIPTION_PROVIDER[user?.subscription?.provider]?.title}+ title={subscriptionProviderInfo?.title}onPress={() => {presentSheet({- title: SUBSCRIPTION_PROVIDER[user?.subscription?.provider].title,- paragraph: SUBSCRIPTION_PROVIDER[user?.subscription?.provider].desc+ title: subscriptionProviderInfo.title,+ paragraph: subscriptionProviderInfo.desc});}}style={{alignSelf: 'flex-start',- paddingHorizontal: 0+ borderRadius: 100}}fontSize={SIZE.sm}- textStyle={{- fontWeight: 'normal'- }}height={30}- type="transparent"+ type="grayAccent"/>) : null}</View>diff --git a/apps/mobile/src/screens/settings/usersection.js b/apps/mobile/src/screens/settings/usersection.jsindex 1ca9d82d4..04e16fbec 100644--- a/apps/mobile/src/screens/settings/usersection.js+++ b/apps/mobile/src/screens/settings/usersection.js@@ -1,23 +1,13 @@import dayjs from 'dayjs';import React from 'react';-import { Linking, Platform, View } from 'react-native';+import { View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import { Button } from '../../components/ui/button';-import Seperator from '../../components/ui/seperator';import { TimeSince } from '../../components/ui/time-since';import Heading from '../../components/ui/typography/heading';import Paragraph from '../../components/ui/typography/paragraph';-import { eSendEvent, presentSheet, ToastEvent } from '../../services/event-manager';-import PremiumService from '../../services/premium';import { useUserStore } from '../../stores/stores';import { useThemeStore } from '../../stores/theme';-import {- SUBSCRIPTION_PROVIDER,- SUBSCRIPTION_STATUS,- SUBSCRIPTION_STATUS_STRINGS-} from '../../utils/constants';-import { eOpenPremiumDialog } from '../../utils/events';-import { usePricing } from '../../utils/hooks/use-pricing';+import { SUBSCRIPTION_STATUS_STRINGS } from '../../utils/constants';import { SIZE } from '../../utils/size';import { SectionItem } from './section-item';@@ -34,46 +24,19 @@ const SettingsUserSection = ({ item }) => {const user = useUserStore(state => state.user);const subscriptionDaysLeft = user && getTimeLeft(parseInt(user.subscription?.expiry));- const isExpired = user && subscriptionDaysLeft.time < 0;- const expiryDate = dayjs(user?.subscription?.expiry).format('MMMM D, YYYY');- const startDate = dayjs(user?.subscription?.start).format('MMMM D, YYYY');- const monthlyPlan = usePricing('monthly');- const isBasic = user?.subscription?.type === SUBSCRIPTION_STATUS.BASIC;- const isTrial = user?.subscription?.type === SUBSCRIPTION_STATUS.TRIAL;- const isPro = user?.subscription?.type === SUBSCRIPTION_STATUS.PREMIUM;- const isNotPro =- user?.subscription?.type !== SUBSCRIPTION_STATUS.PREMIUM &&- user?.subscription?.type !== SUBSCRIPTION_STATUS.BETA;+ // const isExpired = user && subscriptionDaysLeft.time < 0;+ // const expiryDate = dayjs(user?.subscription?.expiry).format('MMMM D, YYYY');+ // const startDate = dayjs(user?.subscription?.start).format('MMMM D, YYYY');+ // const monthlyPlan = usePricing('monthly');+ // const isBasic = user?.subscription?.type === SUBSCRIPTION_STATUS.BASIC;+ // const isTrial = user?.subscription?.type === SUBSCRIPTION_STATUS.TRIAL;+ // const isPro = user?.subscription?.type === SUBSCRIPTION_STATUS.PREMIUM;+ // const isNotPro =+ // user?.subscription?.type !== SUBSCRIPTION_STATUS.PREMIUM &&+ // user?.subscription?.type !== SUBSCRIPTION_STATUS.BETA;const lastSynced = useUserStore(state => state.lastSynced);- const manageSubscription = () => {- if (!user.isEmailConfirmed) {- PremiumService.showVerifyEmailDialog();- return;- }- if (- user.subscription?.type === SUBSCRIPTION_STATUS.PREMIUM_CANCELLED &&- Platform.OS === 'android'- ) {- if (user.subscription?.provider === 3) {- ToastEvent.show({- heading: 'Subscribed on web',- message: 'Open your web browser to manage your subscription.',- type: 'success'- });- return;- }- Linking.openURL(- Platform.OS === 'ios'- ? 'https://apps.apple.com/account/subscriptions'- : 'https://play.google.com/store/account/subscriptions'- );- } else {- eSendEvent(eOpenPremiumDialog);- }- };-return (<>{user ? (