Files
iNaturalistReactNative/tsconfig.json
Johannes Klein 21ea3ea386 Add some TS to our use of react-navigation (#3454)
* Add tsconfig options

Following https://reactnavigation.org/docs/typescript/?config=dynamic

* Add a navigation types file with root stack params list

* Use param list type

* Add root type for creating the navigation container ref

* Add onboarding stack param list

* Migrate OnboardingStackNavigator to TS

* Update param list type

* Update import path

* Add BottomTabParamList

* Add NoBottomTabStackParamList

* Migrate NoBottomTabStackNavigator to TS

* Add param list type

* Type options as const

* Change headerLeft option

According to the documentation (and type) this should either be a function that returns null, or undefined.

* Migrate SharedStackScreens to TS

* Just realized that SharedStack creates it's own stack navigator

* Refactor screenOptions into standalone object

* createNativeStack has not cardStyle option

I am assuming here that contentStyle is what was supposed to be set here without testing this change.

* Use header props type as provided by library

* Add LoginStackParamList

* Migrate LoginStackNavigator to TS

* Use LoginStackParamList

* Type screen options as const

* Migrate TabStackNavigator to TS file

* Add TabStackParamList

* Type screen options as const

* Create type for the bottom tab navigator props

* Use actual values possible only for the initialRouteName

* Refactor base screen options into standalone object

* Refactor debug group screen options as const

* Add missing screen

* Use Log as screen name

Follows current naming standard

* Update Log route params type

* Let function component return type be inferred

* Clean up no longer used screens

These components are not actually used as navigation screens anymore but only as modals that are shown inside of ExploreFilters.

* Type nested root navigators with the NavigatorScreenParams utility

* Move param list

* Specifying default type in the same file (move from existing type file)

https://reactnavigation.org/docs/typescript/?config=dynamic#specifying-default-types-for-usenavigation-link-ref-etc

* Composite first level of screen props

* Second nested level screen params composition

* Update BottomTabParamList to be typed as nested navigators

https://reactnavigation.org/docs/typescript/?config=dynamic#type-checking-screens-and-params-in-nested-navigator

* Make native stack screen props generic

* Two examples of using typed route params

* Use alias import

* Move file to be .ts

* For the two navigators with shared screens, intersect  param type with the shared stack params
2026-03-24 01:13:09 +01:00

29 lines
842 B
JSON

{
"extends": "@react-native/typescript-config",
"compilerOptions": {
"baseUrl": ".",
"moduleResolution": "bundler",
"paths": {
"*": ["src/*"],
"appConstants": ["src/appConstants"],
"api": ["src/api"],
"components": ["src/components"],
"dictionaries": ["src/dictionaries"],
"i18n": ["src/i18n"],
"images": ["src/images"],
"navigation": ["src/navigation"],
"providers": ["src/providers"],
"realmModels": ["src/realmModels"],
"sharedHelpers": ["src/sharedHelpers"],
"sharedHooks": ["src/sharedHooks"],
"stores": ["src/stores"],
"styles": ["src/styles"],
"tests": ["tests"],
},
"strict": true,
"types": ["nativewind/types"],
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["flow-typed", "**/node_modules", "**/Pods"]
}