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
(router): add url hash support #27105
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
976d8bf
to
70d0375
Compare
it(`returns the pathname without hash for ${url}`, () => { | ||
expect(getUrlWithReactNavigationConcessions(url).inputPathnameWithoutHash).toBe(expected); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were removed as inputPathnameWithoutHash
isn't actually used in the code base and we not support hashes
7134b17
to
a384a1f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs changes lgtm 👍
|
||
The URL (hash)[https://developer.mozilla.org/en-US/docs/Web/API/URL/hash] is a string that follows the `#` symbol in a URL. It is commonly used on websites to link to a specific section of a page, but it can also be used to store data. Expo Router treats the hash as a special search parameter using the name `#`. It can be accessed and modified using the same hooks and APIs from [search parameters](/router/reference/search-parameters/). | ||
|
||
```tsx app/hash.tsx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
```tsx app/hash.tsx | |
```tsx app/index.tsx |
Comment out docs so they are not deployed |
a384a1f
to
7fe7e6a
Compare
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
Co-authored-by: Aman Mittal <amandeepmittal@live.com>
Co-authored-by: Aman Mittal <amandeepmittal@live.com>
6393907
to
0f27456
Compare
# Why <!-- Please describe the motivation for this PR, and link to relevant GitHub issues, forums posts, or feature requests. --> Follow-up #27105 # How <!-- How did you build this feature or fix this bug and why? --> After confirming with @marklawlor, the "Hash support" section is unversioned for now so we should hide it. # Test Plan <!-- Please describe how you tested this change and how a reviewer could reproduce your test, especially if this PR does not include automated tests! If possible, please also provide terminal output and/or screenshots demonstrating your test/reproduction. --> Run docs locally and visit: http://localhost:3002/router/reference/search-parameters/ ## Preview ![CleanShot 2024-03-14 at 17 50 16@2x](https://github.com/expo/expo/assets/10234615/207ddeff-1df1-4ecb-934a-14dead6c7454) # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
Why
Adds URL hash support to Expo Router. This enable 3rd party services that use the hash as part of work flows (e.g authentication)
How
The hash is converted into a search parameter called
#
. This was chosen as its not a valid search parameter and the encoded version is unlikely to be in use.Test Plan
Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).