-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
team-mobile-platformMobile Platform teamMobile Platform team
Description
What is this about?
useRoute and useParams does not pick up on the globally defined navigation types. As a result, the navigation param types can be missed while using these hooks. For better type safety, two changes can be made for each component:
- A component's prop type definition should use
StackScreenPropsand reference root param list along with its associated screen name. Ex.type ComponentProp = StackScreenProps<RootParamList, 'ComponentScreenName'> - Instead of deriving params from
useRouteoruseParams, accessroute.paramsfrom props
Scenario
No response
Design
No response
Technical Details
- A component's prop type definition should use
StackScreenPropsand reference root param list along with its associated screen name. Ex.type ComponentProp = StackScreenProps<RootParamList, 'ComponentScreenName'> - Instead of deriving params from
useRouteoruseParams, accessroute.paramsfrom props - Components being updated will need an associated entry in the root params list, which is used as reference in generic types
Threat Modeling Framework
No response
Acceptance Criteria
- Components updated using
StackScreenPropsandroute.paramsshould have proper type safety on available route param properties
Stakeholder review needed before the work gets merged
- Engineering (needed in most cases)
- Design
- Product
- QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- Security
- Legal
- Marketing
- Management (please specify)
- Other (please specify)
References
Metadata
Metadata
Assignees
Labels
team-mobile-platformMobile Platform teamMobile Platform team