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

New API for unhandled linking #11672

Merged
merged 16 commits into from Nov 12, 2023
Merged

New API for unhandled linking #11672

merged 16 commits into from Nov 12, 2023

Conversation

osdnk
Copy link
Member

@osdnk osdnk commented Oct 28, 2023

To make the API easier, we decided to make the hook attached directly to the navigator, instead of returning the function to handle the link.

Now, an unhandled link will be handled on the route change via the provided callback. In order to cancel unhandled links, we provide an additional function clearUnhandledLink

@netlify
Copy link

netlify bot commented Oct 28, 2023

Deploy Preview for react-navigation-example ready!

Name Link
🔨 Latest commit 4e61d8f
🔍 Latest deploy log https://app.netlify.com/sites/react-navigation-example/deploys/655133c3c6ce5f0008ba4030
😎 Deploy Preview https://deploy-preview-11672--react-navigation-example.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@osdnk osdnk marked this pull request as ready for review October 31, 2023 16:04
osdnk and others added 4 commits October 31, 2023 18:52
Previously when using nested navigation API, we used that screen as `initialRouteName`.

e.g.

```js
navigation.navigate('MyScreen', { screen: 'NestedScreen' });
```

Here, the `'NestedScreen`` will be set as `initialRouteName`.

It has the result of rendering the navigator with that screen as focused screen. While this behaviour is expected, that screen was also used as the `initialRouteName` for every other operation ignoring the `initialRouteName` prop - which is not expected.

This change refactors the way the focused screen for initial render is set to avoid this behavior.
@codecov-commenter
Copy link

codecov-commenter commented Nov 2, 2023

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (7d109cf) 75.76% compared to head (4e61d8f) 75.98%.
Report is 3 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11672      +/-   ##
==========================================
+ Coverage   75.76%   75.98%   +0.21%     
==========================================
  Files         208      207       -1     
  Lines        5976     5937      -39     
  Branches     2321     2299      -22     
==========================================
- Hits         4528     4511      -17     
+ Misses       1398     1376      -22     
  Partials       50       50              
Files Coverage Δ
packages/core/src/BaseNavigationContainer.tsx 64.04% <100.00%> (-1.18%) ⬇️
packages/core/src/useNavigationBuilder.tsx 97.00% <100.00%> (-0.06%) ⬇️
packages/core/src/useNavigationHelpers.tsx 100.00% <ø> (ø)
packages/core/src/useOnAction.tsx 97.61% <ø> (-0.11%) ⬇️
packages/native/src/LinkingContext.tsx 60.00% <ø> (+17.14%) ⬆️
packages/native/src/NavigationContainer.tsx 85.41% <100.00%> (+1.69%) ⬆️
packages/native/src/useLinking.tsx 87.15% <100.00%> (ø)
...ages/stack/src/navigators/createStackNavigator.tsx 50.00% <ø> (ø)
packages/stack/src/views/Stack/Card.tsx 61.79% <ø> (-0.64%) ⬇️
packages/stack/src/views/Stack/CardContainer.tsx 70.73% <ø> (ø)
... and 4 more

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@osdnk osdnk changed the title @osdnk/new api unhandled linking New API for unhandled linking Nov 2, 2023
@osdnk osdnk marked this pull request as draft November 2, 2023 22:53
@osdnk osdnk requested a review from satya164 November 2, 2023 22:56
@osdnk osdnk marked this pull request as ready for review November 2, 2023 22:58
packages/routers/src/types.tsx Outdated Show resolved Hide resolved
@satya164 satya164 merged commit 5758b26 into main Nov 12, 2023
8 checks passed
@satya164 satya164 deleted the @osdnk/new-api-unhandled-linking branch November 12, 2023 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants