From fbb67abf827d642e7574a182db8770ecd7b81179 Mon Sep 17 00:00:00 2001 From: Ivan Vershigora Date: Tue, 29 Nov 2022 16:11:39 +0000 Subject: [PATCH] feat: draggable widgets --- index.js | 11 +- src/assets/icons/wallet.ts | 3 + src/components/AuthWidget.tsx | 51 +++-- src/components/BlocksWidget.tsx | 9 +- src/components/FactsWidget.tsx | 51 +++-- src/components/FeedWidget.tsx | 62 ++--- src/components/HeadlinesWidget.tsx | 66 +++--- .../{BitfinexWidget.tsx => PriceWidget.tsx} | 13 +- src/components/Widgets.tsx | 211 +++++++++++------- src/screens/Wallets/Send/AutoRebalance.tsx | 2 +- src/screens/Wallets/index.tsx | 16 +- src/screens/Widgets/WidgetFeedEdit.tsx | 4 +- src/store/actions/actions.ts | 1 + src/store/actions/widgets.ts | 7 + src/store/index.ts | 2 +- src/store/reducers/widgets.ts | 6 + src/store/shapes/widgets.ts | 1 + src/store/types/widgets.ts | 1 + src/styles/components.ts | 8 + 19 files changed, 326 insertions(+), 199 deletions(-) rename src/components/{BitfinexWidget.tsx => PriceWidget.tsx} (95%) diff --git a/index.js b/index.js index 72a480f61..a8e0e6655 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,14 @@ Text.defaultProps.allowFontScaling = false; TextInput.defaultProps = TextInput.defaultProps || {}; TextInput.defaultProps.allowFontScaling = false; -// TEMP: ignore warning on iOS -LogBox.ignoreLogs(['Modal with']); +LogBox.ignoreLogs([ + 'Require cycle', + // TEMP: ignore warning on iOS + 'Modal with', + // we have react-native-draggable-flatlist inside on main screen + // unfortunalty, there is not good way to hide this error yet + // https://github.com/computerjazz/react-native-draggable-flatlist/issues/422 + 'VirtualizedLists should never be nested inside plain ScrollViews', +]); AppRegistry.registerComponent(appName, () => gestureHandlerRootHOC(Root)); diff --git a/src/assets/icons/wallet.ts b/src/assets/icons/wallet.ts index 5f7136433..7141e5f3b 100644 --- a/src/assets/icons/wallet.ts +++ b/src/assets/icons/wallet.ts @@ -277,3 +277,6 @@ export const plusCircledIcon = (color = '#75BF72'): string => `; + +export const keyIcon = (color = 'white'): string => + ``; diff --git a/src/components/AuthWidget.tsx b/src/components/AuthWidget.tsx index 409ad9c18..7b389f0c5 100644 --- a/src/components/AuthWidget.tsx +++ b/src/components/AuthWidget.tsx @@ -10,6 +10,8 @@ import { Client } from '@synonymdev/slashtags-auth'; import { useProfile, useSelectedSlashtag } from '../hooks/slashtags'; import { + KeyIcon, + ListIcon, Text01M, TouchableOpacity, TrashIcon, @@ -25,9 +27,15 @@ import Dialog from './Dialog'; const AuthWidget = ({ url, widget, + isEditing = false, + onLongPress, + onPressIn, }: { url: string; widget: IWidget; + isEditing?: boolean; + onLongPress?: () => void; + onPressIn?: () => void; }): ReactElement => { const [showButtons, setShowButtons] = useState(false); const [showDialog, setShowDialog] = useState(false); @@ -72,6 +80,8 @@ const AuthWidget = ({ {profile?.name || ' '} - {showButtons ? ( + {showButtons && widget.magiclink && !isEditing && ( - {widget.magiclink && ( - <> -