diff --git a/app/app.tsx b/app/app.tsx index 310aa7c..4d48d70 100644 --- a/app/app.tsx +++ b/app/app.tsx @@ -10,19 +10,16 @@ * if you're interested in adding screens and navigators. */ import "react-native-gesture-handler" -import React, { useEffect, useRef } from "react" -import { NavigationContainerRef } from "@react-navigation/native" +import React, { useEffect } from "react" import { SafeAreaProvider, initialWindowMetrics } from "react-native-safe-area-context" import { initFonts } from "./theme/fonts" // expo import { useBackButtonHandler, RootNavigator, canExit, - setRootNavigation, useNavigationPersistence, - RootParamList, + navigationRef, } from "./navigators" -import { ToggleStorybook } from "../storybook/toggle-storybook" // This puts screens in a native ViewController or Activity. If you want fully native // stack navigation, use `createNativeStackNavigator` in place of `createStackNavigator`: @@ -42,13 +39,13 @@ export const NAVIGATION_PERSISTENCE_KEY = "NAVIGATION_STATE" */ function App() { const [ready, setReady] = useState(false) - const navigationRef = useRef>(null) - setRootNavigation(navigationRef) - useBackButtonHandler(navigationRef, canExit) - const { initialNavigationState, onNavigationStateChange } = useNavigationPersistence( - NAVIGATION_PERSISTENCE_KEY, - ) + useBackButtonHandler(canExit) + const { + initialNavigationState, + onNavigationStateChange, + isRestored: isNavigationStateRestored, + } = useNavigationPersistence(NAVIGATION_PERSISTENCE_KEY) // Kick off initial async loading actions, like loading fonts useEffect(() => { @@ -59,20 +56,18 @@ function App() { })() }, []) - if (!ready) return null + if (!ready || !isNavigationStateRestored) return null return ( - - - - - - - + + + + + ) } diff --git a/app/clients/TrackDownloadsClient.ts b/app/clients/TrackDownloadsClient.ts index f398010..9de2fc0 100644 --- a/app/clients/TrackDownloadsClient.ts +++ b/app/clients/TrackDownloadsClient.ts @@ -99,7 +99,13 @@ export class TrackDownloadsClient { const currentState = this.fetchDownloadState(track.trackId) if (currentState.type === "NOT_DOWNLOADED" || currentState.type === "FAILED_DOWNLOADING") { - const callback = ({ totalBytesWritten, totalBytesExpectedToWrite }) => { + const callback = ({ + totalBytesWritten, + totalBytesExpectedToWrite, + }: { + totalBytesWritten: number + totalBytesExpectedToWrite: number + }) => { const state = this.fetchDownloadState(track.trackId) if (state.type === "DOWNLOADING" || state.type === "DOWNLOAD_PAUSED") { state.progress = totalBytesWritten / totalBytesExpectedToWrite diff --git a/app/components/auto-image/auto-image.story.tsx b/app/components/auto-image/auto-image.story.tsx deleted file mode 100644 index 7611752..0000000 --- a/app/components/auto-image/auto-image.story.tsx +++ /dev/null @@ -1,31 +0,0 @@ -/* eslint-disable */ -import * as React from "react" -import { storiesOf } from "@storybook/react-native" -import { StoryScreen, Story, UseCase } from "../../../storybook/views" -import { AutoImage } from "./auto-image" - -declare let module - -// const bowser = require("../../screens/welcome/bowser.png") -const morty = { uri: "https://rickandmortyapi.com/api/character/avatar/2.jpeg" } - -storiesOf("AutoImage", module) - .addDecorator((fn) => {fn()}) - .add("Style Presets", () => ( - - {/* - - - - - - */} - - - - - - - - - )) diff --git a/app/components/button/button.story.tsx b/app/components/button/button.story.tsx deleted file mode 100644 index abf3d3f..0000000 --- a/app/components/button/button.story.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import * as React from "react" -import { ViewStyle, TextStyle, Alert } from "react-native" -import { storiesOf } from "@storybook/react-native" -import { StoryScreen, Story, UseCase } from "../../../storybook/views" -import { Button } from "./button" - -declare let module - -const buttonStyleArray: ViewStyle[] = [{ paddingVertical: 100 }, { borderRadius: 0 }] - -const buttonTextStyleArray: TextStyle[] = [{ fontSize: 20 }, { color: "#a511dc" }] - -storiesOf("Button", module) - .addDecorator((fn) => {fn()}) - .add("Style Presets", () => ( - - -