Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('raises an error when call without options', () => {
// $ExpectError - first argument required
Navigation.setDefaultOptions();
});
});
? {
id: 'scanButton',
icon: scanIcon,
color: 'white',
}
: {}
const defaultProfileEditButton = {
id: 'edit',
text: 'Edit',
}
/**
* Some options have not been updated in the nav library so we need to override it :(
*/
Navigation.setDefaultOptions({
animations: {
setRoot: {
alpha: {
from: 0,
to: 1,
duration: 500,
},
},
},
layout: {
backgroundColor: Theme.colors.secondary.background,
},
sideMenu: {
right: {
enabled: true,
// @ts-ignore
const startOnboarding = async () => {
Navigation.setDefaultOptions({
animations: {
setRoot: {
alpha: {
from: 0,
to: 1,
duration: 500,
},
},
},
topBar: {
drawBehind: true,
background: {
color: 'transparent',
},
// @ts-ignore
buttonColor: 'white',
Navigation.events().registerAppLaunchedListener(async () => {
// Default options for all screens
Navigation.setDefaultOptions({
topBar: {
visible: true,
backButton: {
color: 'black',
showTitle: false
},
hideBackButtonTitle: true,
backButtonImage: images.example,
},
});
startFromHome();
});
it('should return nothing', () => {
(Navigation.setDefaultOptions({}): void);
});
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setDefaultOptions(AppDefaultOptions);
//先看看是不是登陆了的
SaveLocalUtil.load(Const.SAVE_LOCAL_LOGINED_USER_DATA, (data: User) => {
if (data && !CommonUtil.isEmpty(data.userId) && !CommonUtil.isEmpty(data.userName) && !CommonUtil.isEmpty(data.userToken)) {
//进入主页
gotoHome(data);
} else {
//进入登陆页面
gotoLogin();
}
});
if (!CommonUtil.isDebug) {
CheckCodePushUpdateUtil.checkUpdate();
}
async launchRoot() {
await Navigation.setDefaultOptions({
...Theme.navigator.styles
});
const state = this.store.getState();
let screen = 'ForestWatcher.Home';
if (state.user.loggedIn && state.app.synced) {
screen = 'ForestWatcher.Dashboard';
}
await launchAppRoot(screen);
await this._handleAppStateChange('active');
}
orientation: ['portrait'],
direction: isRTL ? 'rtl' : 'ltr',
},
};
if (Platform.OS === 'android') {
defaultOptions.animations = {
push: { enabled: 'false' },
pop: { enabled: 'false' },
setRoot: { enabled: 'false' },
showModal: { enabled: 'false' },
dismissModal: { enabled: 'false' },
};
}
Navigation.setDefaultOptions(defaultOptions);
const currentAppVersion = await currentAppVersionPromise;
const newVersion = appVersion == null || appVersion !== currentAppVersion;
hydrate(newVersion || __DEV__);
if (newVersion) {
setAppVersion(currentAppVersion);
}
const { setLocale, setRTL } = setI18nConfig(locale);
const store = configureStore({
device: { locale: setLocale, isRTL: setRTL, appVersion, museumMode },
});
audioActor(store);
setDefaultOptions(props) {
return Navigation.setDefaultOptions(props)
},