0

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?

Jim
  • 1,988
  • 6
  • 34
  • 68

1 Answers1

0

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

angelos_lex
  • 1,593
  • 16
  • 24