Replies: 2 comments
-
Technically head is defining invisible metadata for the "current context" regardless of platform. We could expose the head metadata in the future so custom views could use it as a default, but this would probably not be a great default. As you pointed out, head titles can often be long and contain breadcrumbs like |
Beta Was this translation helpful? Give feedback.
-
Indeed. What I was trying to achieve, is to reuse the native screen titles for the Since every screen usually has a title already defined via Using something like the following in the main layout component, would make things easier: const screenTitle = // Grab the current Screen title
…
<Head>
<title>{screenTitle} | My App</title>
</Head> |
Beta Was this translation helpful? Give feedback.
-
The addition of the new component, together with disabling setting the document.title with React Navigation, seems to lead to some duplication, since one now would have to define all screen titles twice, once for native via layouts or
<Stack.Screen title>
and once for web via the<Head>
component?Is this configurable like the corresponding React Navigation option?
If not, one way to get a HTML title, for new projects and when upgrade existing Expo Router v1 apps, without having to add a
<Head>
component to each screen, would be to add it to the main web layout component like this:Is there a way to get the title of the current screen in a parent layout?
Beta Was this translation helpful? Give feedback.
All reactions