Replies: 1 comment
-
Hi @Almouro, As always - Pull Requests are more than welcome! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Great work with react-native-screens, we migrated most of our screens to react-native-screens and already see great performance improvements. 🎉
One thing that was tricky was migrating
headerTitle
containing a React component. I know aboutheaderCenter
but these are the issues I had with it:1. headerCenter is also centered on Android while headerTitle is left aligned by default
If we want to follow default guidelines, we should left align our title to the left on Android.
I thought it would be easy by wrapping the title like so:
However
width: 100%
seems to be the width of the whole navbar, which brings the second point.2. width: 100% on headerCenter takes the whole navbar width
Setting a
headerTitle
and aheaderRight
is awesome withreact-native-screens
because it handles very well long content, for instance:However we lose this behavior with
headerCenter
:3. Some components in our app can be used by JS stacks or Native stacks
We still use JS stacks in a few places in our app, because it provides more flexibility to parameterize transitions. Essentially we have a main native stack navigator and some JS nested stacks.
Some components set the header title and can be used by either a native screen or a JS screen which makes this tricky since:
headerTitle
headerTitle
crashes the native screenSo the component cannot just do
Essentially the component has to know whether it's in a native stack screen or a JS one, which shouldn't be its responsibility in my opinion.
It would be ideal if
react-native-screens
supported components inheaderTitle
(and could convert it to aheaderCenter
)Beta Was this translation helpful? Give feedback.
All reactions