Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const navigateToRoot = () => {
// navigate(ROOT_SCREEN);
_navigator.dispatch(
StackActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: ROOT_SCREEN })]
})
);
};
_validationPassword = () => {
let passwordLegal = Util.checkPassword(this.state.password)
if (passwordLegal) {
Keyboard.dismiss()
// 不是 android 手机的情况下才调用 notice (各种不同厂家的状态栏不一样没法统一处理)
!this.from ? bouncedUtils.notices.show({
type: 'success', content: '注册成功'
}) : bouncedUtils.notices.show({
type: 'success', content: '修改成功'
})
/** 跳转到首页,是否需要清空用户上次的输入信息,根据实际自行补充 */
Routers.stackRoots.dispatch(
StackActions.reset({
index: 0,
actions: [
NavigationActions.navigate({routeName: 'MainStack'})
// NavigationActions.navigate({routeName: 'InstalmentPage'})
]
})
)
/** 储存用户登陆密码,到达这里,用户已经注册成功 */
if (!this.from) {
StorageData.mergeData('registerInfo', {
password: this.state.password,
hasRegister: true,
hasLogin: true,
...this.props.navigation.state.params,
export function goRoom({ rid, name }, counter = 0) {
// about counter: we can call this method before navigator be set. so we have to wait, if we tried a lot, we give up ...
if (!rid || counter > 10) {
return;
}
if (!config.navigator) {
return setTimeout(() => goRoom({ rid, name }, counter + 1), 100);
}
const action = StackActions.reset({
index: 1,
actions: [
NavigationActions.navigate({ key: 'RoomsList', routeName: 'RoomsList' }),
NavigationActions.navigate({ key: `Room-${ rid }`, routeName: 'Room', params: { room: { rid, name }, rid, name } })
]
});
config.navigator.dispatch(action);
}
_goToHomePage() {
// @see https://github.com/react-community/react-navigation/issues/1127
const resetAction = StackActions.reset({
index: 0,
key: null,
actions: [NavigationActions.navigate({ routeName: 'dashboard' })],
});
this.props.navigation.dispatch(resetAction);
}
.database()
.ref(`Users/${uid}`)
.once('value')
const userModel = snapshot.val()
firebase
.database()
.ref(`Users/${uid}`)
.update({
lastSignIn: new Date().getTime(),
version: settings.VERSION,
})
if (userModel && userModel.name && userModel.avatarURL) {
dispatch({ type: HIDE_NETWORK_ACTIVITY })
navigation.dispatch(
StackActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: 'Main' })],
}),
)
return
}
dispatch({ type: HIDE_NETWORK_ACTIVITY })
navigation.dispatch(
StackActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: 'Setup' })],
}),
)
return
} catch (e) {
console.log(e)
for( let i = 0; i < removeControllers.length; i++ )
{
let currentController = removeControllers[i];
realm.delete( currentController );
}
realm.commitTransaction();
}
).catch(
function( e )
{
console.log( e );
}
);
const resetNavStack = StackActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'Home'})
] })
this.props.navigation.dispatch( resetNavStack );
}
logoutAction = () => {
const resetAction = StackActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'Login'})
]
});
this.props.navigation.dispatch(resetAction);
};
}
function reset(routeName: string, params?: NavigationParams) {
_container.dispatch(
StackActions.reset({
index: 0,
actions: [
NavigationActions.navigate({
type: 'Navigation/NAVIGATE',
routeName,
params,
}),
],
}),
);
}
setTimeout (() => {
const resetAction = StackActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'Home'})
]
});
this.props.navigation.dispatch(resetAction);
}, 3100);
}