topBar.title.fontFamily is being reset with mergeOptions
Have a topBar.title.fontFamily set in defaultOptions and try to dynamically adjust the topBar by using mergeOptions. The fontFamily set in the defaultOptions will not be used.
I have the problem that I can't set the fontFamily at all - it's just ignored. Is this the same bug?
Navigation.setRoot({
root: {
sideMenu: {
id: 'sideMenu',
left: {
component: {
id: MENU_SIDE,
name: MENU_SIDE,
},
},
center: {
stack: {
children: [
{
component: {
name: SCREEN_DASHBOARD,
options: {
topBar: {
noBorder: true,
visible: true,
title: {
text: 'Dashboard',
fontSize: 16,
color: '#171F24',
fontFamily: 'Roboto',
},
subtitle: {
text: 'Dashboard',
fontSize: 13,
color: '#171F24',
fontFamily: 'Roboto',
},
},
},
},
},
],
},
},
},
},
});
fontSize and color are working as expected - but not fontFamily.
And everything is working for subtitle.
🤔
I have it set in Navigation.setDefaultOptions()
see #4188
That's unrelated in my case, since I am not using a subtitle
yep, but as I said in the comment in 4188, for me it was not related to using a subtitle - happened also when just trying to overwrite the fontFamily for title ...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.
this is still a problem afaik
I'm having the same issue with react-native-navigation 2.2.5
.
It seems that Navigation.mergeOptions()
does not perform a deep merge, as simple as that.
@zabojad Looks to be true, seems to be doing a lodash deepClone, but anything deeper than one level like topbar: {
background: {
color: '#fff'
}
}
doesnt work, any solution to this ?
@tyrong I don't have any solution yet.
In my case, I was trying to change the topbar title text after the screen shows up with a hidden topbar (visible: false
option).
So I was doing:
Navigation.mergeOptions(props.componentId,{ topBar: { visible: true, title: { text: "blablabla..." }}});
and was loosing all my topBar default options.
I tried to workaround this problem by reseting at the same time all default options. It almost worked except for the alignment: 'center'
option (Android) that I'm still loosing in that case...
The deep merge is perhaps one thing but it might not be the only issue with mergeOptions for topBar...
@guyca I'm having that on Android (I see you've tagged this issue as an iOS one).
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.
The issue has been closed for inactivity.
This is not stale. I can still reproduce.
[Hateful anti stale bot comment stating that I also have this issue]