Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forbid implicit any #59

Merged
merged 4 commits into from
Oct 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 18 additions & 23 deletions app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand All @@ -42,13 +39,13 @@ export const NAVIGATION_PERSISTENCE_KEY = "NAVIGATION_STATE"
*/
function App() {
const [ready, setReady] = useState(false)
const navigationRef = useRef<NavigationContainerRef<RootParamList>>(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(() => {
Expand All @@ -59,20 +56,18 @@ function App() {
})()
}, [])

if (!ready) return null
if (!ready || !isNavigationStateRestored) return null

return (
<ToggleStorybook>
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
<TrackDownloadsClientProvider client={new TrackDownloadsClient()}>
<RootNavigator
ref={navigationRef}
initialState={initialNavigationState}
onStateChange={onNavigationStateChange}
/>
</TrackDownloadsClientProvider>
</SafeAreaProvider>
</ToggleStorybook>
<SafeAreaProvider initialMetrics={initialWindowMetrics}>
<TrackDownloadsClientProvider client={new TrackDownloadsClient()}>
<RootNavigator
ref={navigationRef}
initialState={initialNavigationState}
onStateChange={onNavigationStateChange}
/>
</TrackDownloadsClientProvider>
</SafeAreaProvider>
)
}

Expand Down
8 changes: 7 additions & 1 deletion app/clients/TrackDownloadsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 0 additions & 31 deletions app/components/auto-image/auto-image.story.tsx

This file was deleted.

33 changes: 0 additions & 33 deletions app/components/button/button.story.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions app/components/flat-list/flat-list.story.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions app/components/icon/icon.story.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions app/components/list-button-item/list-button-item.story.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions app/components/list-checkbox-item/list-checkbox-item.story.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions app/components/section-list/section-list.story.tsx

This file was deleted.

146 changes: 0 additions & 146 deletions app/components/text-field/text-field.story.tsx

This file was deleted.

Loading