react-navigation / react-navigation/react-navigation.github.io

How to add type annotaion for custom header props.

Open
#1,132 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
324
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

I have created a custom header for Drawer Navigator. I have used DrawerHeaderProps for its prop type, but this does not give strict type-checking behavior like what we get when we use DrawerScreenProps<HomeDrawerParamList, 'Home'>. I was unable to find any documentation for this particular thing. I thought about extending DrawerHeaderProps with the navigation property type as extended type of CompositeScreenProps. Is it a good idea to do it this way? Or should I use the useNavigation hook instead?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing Drawer Navigator and TypeScript documentation for custom headers and typed navigation. Clarify how DrawerHeaderProps relates to DrawerScreenProps, CompositeScreenProps, and useNavigation, then document the recommended approach and a representative type-checking example.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.