-
Notifications
You must be signed in to change notification settings - Fork 0
Nav/navigation md #229
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
Nav/navigation md #229
Conversation
a05c4a8
to
4cff415
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.
Hey very nice job, I know nobody likes to write docs but someone has to 😆 🚀
Since this is a lot of comments I tried to mark several as [nitpick]
so feel free to ignore these if you don't agree - these are mostly my opinions.
As far as the rest, they fall mostly into 2 categories:
- typos/grammar
- too long sentences, some I think fall into the "run-on sentence" category I think.
One general comment is that sometimes I think we could use more md headings deeper inside the code (docs). I would suggest you "hoist" the nesting of whole doc 1 level up (so you could make ToC and every top level point a h1 (#
) and then maybe you could use more heading below these.
As far as content I think this gives a great deep dive into how navigation works 👍
Good job
contributingGuides/NAVIGATION.md
Outdated
|
||
- `Dismiss` - Closes any modals (outside the navigation hierarchy) or pops a nested stack of screens off returning the user to the previous screen in the main stack. | ||
`Navigation.navigate` is used to go to a specific screen in the app or replace the existing one. This function works based on an extended implementation of the `linkTo` method. Because of this, there are some differences between using our function and `navigate` returned from `useNavigation` hook. |
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.
`Navigation.navigate` is used to go to a specific screen in the app or replace the existing one. This function works based on an extended implementation of the `linkTo` method. Because of this, there are some differences between using our function and `navigate` returned from `useNavigation` hook. | |
`Navigation.navigate` is used to go to a specific screen in the app or replace an existing one. This function works based on an extended implementation of the `linkTo` method. Because of this, there are some differences between using our function and the original `navigate` returned from `useNavigation` hook. |
contributingGuides/NAVIGATION.md
Outdated
## Adding RHP flows | ||
> [!NOTE] | ||
> The most relevant differences between our implementation of `Navigation.navigate` and `navigate` returned from `useNavigation`: | ||
> 1. We pass `route` instead of a screen name, because our implementation of `Navigation.navigate` is based on `linkTo` method which accepts `route` as a parameter |
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.
When reading this directly top to bottom, the part about linkTo
seems like a direct repeat of similar line: This function works based on an extended implementation of the 'linkTo' method.
Maybe thats not a problem, but it seemed kinda redundant. Maybe just keep the info about usage of linkTo here and removed from higher up? But I don't have strong opinions about this.
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.
I am wondering if mentioning the linkTo function is relevant at all
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.
I know it's mentioned twice in the same paragraph, but I believe this will make it more visible
contributingGuides/NAVIGATION.md
Outdated
> The most relevant differences between our implementation of `Navigation.navigate` and `navigate` returned from `useNavigation`: | ||
> 1. We pass `route` instead of a screen name, because our implementation of `Navigation.navigate` is based on `linkTo` method which accepts `route` as a parameter | ||
> 2. We import Navigation object from `@libs/Navigation/Navigation` not get it from the hook | ||
> 3. Our method uses `PUSH` not `NAVIGATE` by default!! |
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.
> 3. Our method uses `PUSH` not `NAVIGATE` by default!! | |
> 3. Our method uses `PUSH` instead of `NAVIGATE` by default!! |
contributingGuides/NAVIGATION.md
Outdated
> [!NOTE] | ||
> The most relevant differences between our implementation of `Navigation.navigate` and `navigate` returned from `useNavigation`: | ||
> 1. We pass `route` instead of a screen name, because our implementation of `Navigation.navigate` is based on `linkTo` method which accepts `route` as a parameter | ||
> 2. We import Navigation object from `@libs/Navigation/Navigation` not get it from the hook |
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.
> 2. We import Navigation object from `@libs/Navigation/Navigation` not get it from the hook | |
> 2. We import Navigation object from `@libs/Navigation/Navigation` instead of getting it from the hook |
contributingGuides/NAVIGATION.md
Outdated
|
||
- Since each of those flows is kind of a modal stack, if you want to add a page to the existing flow, you should just add a page to the correct stack in `ModalStackNavigators.tsx`. | ||
To navigate back, we use the `Navigation.goBack` function. We can call this function without any parameters, but the most common case is to call it with `backToRoute`. It is worth remembering that it is possible to deep link to any page in the application, and then we may lose a page to which we should go back from the navigation state. In such a case, we can simply use the mentioned parameter to indicate which page should be opened when going back. |
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.
The sentence:
It is worth remembering that it is possible to deep link to any page in the application, and then we may lose a page to which we should go back from the navigation state.
is quite hard to parse in my head :D it has like 3 parts. I suggest rewriting or splitting into two sentences
contributingGuides/NAVIGATION.md
Outdated
> [!NOTE] | ||
> When nested routes are not rendered their state is lost and when returning to these screens it has to be recreated. To do this the state is saved in the `preservedNavigatorStates` object using the `usePreserveNavigatorState` hook. | ||
|
||
### State persistance after page refresh |
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.
typo - persistence
contributingGuides/NAVIGATION.md
Outdated
|
||
These navigators cover the entire screen and do not have transparent overlay. Each of them has a navigation tab bar icon that is highlighted when that screen is at the top of the navigation stack or visible under the mdal navigator overlay. | ||
|
||
It is worth noting that despite the navigation tab is displayed, the application does not use `BottomTabNavigator`. When one of the navigation tab bar buttons is pressed, a new full screen is pushed onto the root stack. `StackNavigator` was used to implement this groups of screens as it has more flexibility and preserves navigation history in the browser. |
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.
It is worth noting that despite the navigation tab is displayed, the application does not use `BottomTabNavigator`.
Something is no-yes with this sentence ;)
contributingGuides/NAVIGATION.md
Outdated
> [!NOTE] | ||
> To check if a route belongs to a specific group, it is worth using the functions available in `@libs/Navigation/helpers/isNavigatorName`. For example, to check if a route is a `FullScreenNavigator` you can use the `isFullScreenName` function. | ||
|
||
#### When we need to adapt the split navigator state (function `adaptStateIfNecessary`) |
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.
not sure if I'm correct, but should this be:
When >do< we need to adapt the [...]
?
contributingGuides/NAVIGATION.md
Outdated
|
||
#### `NAVIGATORS.REPORTS_SPLIT_NAVIGATOR` (Inbox tab) | ||
|
||
It includes the `HOME` screen (`<BaseSidebarScreen />` component) with a list of reports as a sidebar screen and the `REPORT` screen displayed as a central one. There can be multiple report screens in the stack with different report IDs. |
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.
It includes the `HOME` screen (`<BaseSidebarScreen />` component) with a list of reports as a sidebar screen and the `REPORT` screen displayed as a central one. There can be multiple report screens in the stack with different report IDs. | |
It displays the `HOME` screen (`<BaseSidebarScreen />` component) with a list of reports as a sidebar screen and the `REPORT` screen displayed as a central one. There can be multiple report screens in the stack with different report IDs. |
contributingGuides/NAVIGATION.md
Outdated
|
||
These screens / navigators have a transparent overlay underneath. | ||
|
||
On wide layout we have functionality that ensures that there is at least one full screen under the modal on the stack that will be visible under overlay. |
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.
[...] that ensures that there is at least one full screen under the modal >>on the stack that will be visible<< under overlay.
Kinda reads like it will be the stack that will be visible under. I would rephrase this somehow.
contributingGuides/NAVIGATION.md
Outdated
/** | ||
* Builds a URL with an encoded URI component for the `backTo` param which can be added to the end of URLs | ||
*/ | ||
function getUrlWithBackToParam<TUrl extends string>(url: TUrl, backTo?: string, shouldEncodeURIComponent = true): `${TUrl}` { |
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.
Not sue if we need to show implementation of the getUrlWithBackToParam. I would only add a comment to just use this funciton
contributingGuides/NAVIGATION.md
Outdated
} | ||
``` | ||
|
||
To optimize the number of routes rendered in `RootStackNavigator` we limit the number of `FullScreenNavigators` rendered to 2. |
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.
Maybe it's worth mentioning that we use last two instead of just one to make sure animations works properly
831a9f8
to
06e1474
Compare
06e1474
to
d6957ff
Compare
Explanation of Change
Fixed Issues
$
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectioncanBeMissing
param foruseOnyx
toggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop