diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 515be358..0d991fd2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,8 +16,6 @@ jobs: id: branch - name: -- Step 1 -- Checkout code uses: actions/checkout@v2 - with: - submodules: true - name: -- Step 2 -- Setup node uses: actions/setup-node@v2 with: diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 1a0c8f06..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "src/modules/react-native-image-viewing"] - path = src/modules/react-native-image-viewing - url = https://github.com/xmflsct/react-native-image-viewing.git diff --git a/src/@types/react-navigation.d.ts b/src/@types/react-navigation.d.ts index a87a6078..33834f60 100644 --- a/src/@types/react-navigation.d.ts +++ b/src/@types/react-navigation.d.ts @@ -1,4 +1,6 @@ declare namespace Nav { + import { QueryKeyTimeline } from '@utils/queryHooks/timeline' + type RootStackParamList = { 'Screen-Tabs': undefined 'Screen-Actions': @@ -58,7 +60,6 @@ declare namespace Nav { url: Mastodon.AttachmentImage['url'] width?: number height?: number - preview_url: Mastodon.AttachmentImage['preview_url'] remote_url?: Mastodon.AttachmentImage['remote_url'] }[] id: Mastodon.Attachment['id'] @@ -90,7 +91,7 @@ declare namespace Nav { 'Tab-Shared-Search': { text: string | undefined } 'Tab-Shared-Toot': { toot: Mastodon.Status - rootQueryKey: any + rootQueryKey?: QueryKeyTimeline } 'Tab-Shared-Users': | { diff --git a/src/Screens.tsx b/src/Screens.tsx index 6781fb49..f5c9c232 100644 --- a/src/Screens.tsx +++ b/src/Screens.tsx @@ -45,7 +45,7 @@ const Screens: React.FC = ({ localCorrupt }) => { dark = 'light-content' } - const routeNameRef = useRef() + const routeRef = useRef<{ name?: string; params?: {} }>() const isConnected = useNetInfo().isConnected useEffect(() => { @@ -114,35 +114,37 @@ const Screens: React.FC = ({ localCorrupt }) => { }, [instanceActive]) // Callbacks - const navigationContainerOnReady = useCallback( - () => - (routeNameRef.current = navigationRef.current?.getCurrentRoute()?.name), - [] - ) + const navigationContainerOnReady = useCallback(() => { + const currentRoute = navigationRef.current?.getCurrentRoute() + routeRef.current = { + name: currentRoute?.name, + params: currentRoute?.params + } + }, []) const navigationContainerOnStateChange = useCallback(() => { - const previousRouteName = routeNameRef.current - const currentRouteName = navigationRef.current?.getCurrentRoute()?.name + const previousRoute = routeRef.current + const currentRoute = navigationRef.current?.getCurrentRoute() - const matchTabName = currentRouteName?.match(/(Tab-.*)-Root/) + const matchTabName = currentRoute?.name?.match(/(Tab-.*)-Root/) if (matchTabName) { //@ts-ignore dispatch(updatePreviousTab(matchTabName[1])) } - if (previousRouteName !== currentRouteName) { - Analytics.setCurrentScreen(currentRouteName) + if (previousRoute?.name !== currentRoute?.name) { + Analytics.setCurrentScreen(currentRoute?.name) Sentry.Native.setContext('page', { - previous: previousRouteName, - current: currentRouteName + previous: previousRoute, + current: currentRoute }) } - routeNameRef.current = currentRouteName + routeRef.current = currentRoute }, []) return ( <> - + void + extras?: Omit< + AxiosRequestConfig, + 'method' | 'url' | 'params' | 'headers' | 'data' + > } const apiInstance = async ({ @@ -24,7 +27,7 @@ const apiInstance = async ({ params, headers, body, - onUploadProgress + extras }: Params): Promise<{ body: T; links: { prev?: string; next?: string } }> => { const { store } = require('@root/store') const state = store.getState() as RootState @@ -70,7 +73,7 @@ const apiInstance = async ({ }) }, ...(body && { data: body }), - ...(onUploadProgress && { onUploadProgress: onUploadProgress }) + ...extras }) .then(response => { let prev diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 714f58ba..8efb28c2 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -81,7 +81,7 @@ const Button: React.FC = ({ if (destructive) { return theme.red } else { - return theme.primary + return theme.primaryDefault } } } @@ -97,16 +97,16 @@ const Button: React.FC = ({ if (destructive) { return theme.red } else { - return theme.primary + return theme.primaryDefault } } } }, [mode, loading, disabled]) const colorBackground = useMemo(() => { if (overlay) { - return theme.backgroundOverlay + return theme.backgroundOverlayInvert } else { - return theme.background + return theme.backgroundDefault } }, [mode]) diff --git a/src/components/GracefullyImage.tsx b/src/components/GracefullyImage.tsx index f7da33b2..04ad5270 100644 --- a/src/components/GracefullyImage.tsx +++ b/src/components/GracefullyImage.tsx @@ -102,7 +102,11 @@ const GracefullyImage = React.memo( return (