Skip to content

Commit

Permalink
Merge pull request #59 from simonwacker/forbid-implicit-any
Browse files Browse the repository at this point in the history
Forbid implicit any
  • Loading branch information
simonwacker authored Oct 31, 2021
2 parents fa8f477 + f7aab05 commit 8dbe5c6
Show file tree
Hide file tree
Showing 30 changed files with 320 additions and 4,909 deletions.
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

0 comments on commit 8dbe5c6

Please sign in to comment.