Reputation: 2312
Using Wix's react-native-navigation, what's the difference between setting layout options using these methodologies?
Navigation.setDefaultOptions({
topBar: {
background: {
color: 'red'
}
}
});
vs.
static options(passProps) {
return {
topBar: {
background: {
color: 'red'
}
}
};
}
vs.
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setRoot({
root: {
stack: {
children: [{}],
options: {
topBar: {
background: {
color: 'red'
}
}
}
}
}
});
});
What are some reasons/cases/etc to define options statically inside a component, versus initializing a root with options? And what are the functional differences/what happens behind the scenes with these different ways?
Upvotes: 0
Views: 496
Reputation: 1661
setDefaultOptions
are default options that apply to all screens and all roots that will ever be created.
static options
is defined per screen and override defaultOptions but do not apply for all screens
setRoot
apply for this root only
Upvotes: 0