Skip to content

Commit

Permalink
URL bar improvements (#526)
Browse files Browse the repository at this point in the history
This PR introduces several enhancements to the URL bar:
- The `home` button in expo router projects opens the root URL (`/{}`) with empty params but triggers a metro reload in projects without expo router.
Initial params may be may be introduced in future PRs.
- The `go back` button navigates back through the URL history up to a
limit of 20 URLs.
- A list of the 5 most recently visited URLs is added to the top of
`Select.Content` in the URL bar, followed by an alphabetically sorted
list of all visited URLs.
- Improved responsiveness of `Select.Content` and `Select.Trigger`
components.
- Added a scroll buttons for long URL lists in the `Select.Content`.
- Long URL names now break at dashes and display in full upon hover in
`Select.Content`.
- Added `Expo Router` as an optional dependency to the diagnostics view.

Screenshots:
![Screenshot 2024-09-04 at 11 15
34](https://github.com/user-attachments/assets/49675114-e074-42f3-9ade-9cfaf0108992)
![Screenshot 2024-09-04 at 11 15
59](https://github.com/user-attachments/assets/8d0337a3-b7c7-45d2-be23-3290ca39e35e)
![Screenshot 2024-09-03 at 13 35
04](https://github.com/user-attachments/assets/25629bfd-9fa9-4f99-87f3-7f309e7e6115)

Test Plan:
- Navigate to a non-root path and confirm that clicking the `home button` redirects to the root URL in project using Expo Router and the other without.
- Visit multiple links using both the app interface and the URL bar, then click the `go back` button to validate correct navigation through the URL history (additionally, test with dynamic links and component previews).
- Visit various links and verify that the top 5 most recent URLs are displayed in the correct order.
- Visit a lot of multiple links or component previews to test scroll functionality when the list exceeds the available space.
  • Loading branch information
p-malecki authored Sep 12, 2024
1 parent 3b49d78 commit 313d64d
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions expo-router/app/components/NiceButton.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export const RedButton = () => (

RedButton.storyName = "red";

export let GreenButton = () => (
export let TheLongestNameOfStorybookStoryAkaGreenButton = () => (
<NiceButton
color="green"
onPress={() => console.log("Green button pressed!")}
/>
);

GreenButton.storyName = "green";
TheLongestNameOfStorybookStoryAkaGreenButton.storyName = "green";

const Template = (args) => <NiceButton {...args} />;

Expand All @@ -40,3 +40,27 @@ Dynamic.args = {
};

Dynamic.storyName = "dynamic";

export const A = () => (
<NiceButton color="#ff11aa" onPress={() => console.log("Button A pressed!")} />
);

export const B = () => (
<NiceButton color="#22bb33" onPress={() => console.log("Button B pressed!")} />
);

export const C = () => (
<NiceButton color="#3344cc" onPress={() => console.log("Button C pressed!")} />
);

export const D = () => (
<NiceButton color="#8855ff" onPress={() => console.log("Button D pressed!")} />
);

export const E = () => (
<NiceButton color="#ee7733" onPress={() => console.log("Button E pressed!")} />
);

export const F = () => (
<NiceButton color="#997744" onPress={() => console.log("Button F pressed!")} />
);

0 comments on commit 313d64d

Please sign in to comment.