Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pressEvent() {
const { icon } = this.props;
if (icon === 'settings') SafeAction('Settings');
else if (icon === 'arrow-back') {
Actions.pop();
if (Actions.state.routes.length === 2) {
setTimeout(() => Actions.refresh(), 1000);
}
} else if (icon === 'home') {
Actions.popTo('Menu');
// Clear last location
setLastLocation('');
setTimeout(() => Actions.refresh(), 1000);
} else SafeAction('Search');
}
}
export const BackAction = function(popToName?) {
try {
if (popToName) {
// account for the differences in routers here, not in every usage of this.
// We use the iOS key names in the app code.
if (popToName === 'sphereOverview') {
if (Platform.OS === 'android') {
popToName = 'drawer'
}
}
Actions.popTo(popToName)
}
else {
Actions.pop();
}
} catch (popErr) {
LOGe.info("Pop error:", popErr);
}
};
navigate() {
const { menu } = this.state;
if (menu) {
// Pop to menu
Actions.popTo('Menu');
} else if (Actions.currentScene !== 'Menu') {
// Add guard so that it wont push twice]
Actions.Menu();
}
}
}
componentWillReceiveProps(nextProps) {
if (this.props.logout.status === 'fetching' &&
nextProps.logout.status === 'fetched') {
Routes.popTo('goToSelectServer');
}
}
if (this.isCurrentScene(Constants.LOGIN)) {
return false
}
if (this.isCurrentScene(Constants.WALLET_LIST_SCENE)) {
if (this.backPressedOnce) {
this.props.logout()
} else {
this.backPressedOnce = true
showToast(s.strings.back_button_tap_again_to_exit).then(() => {
this.backPressedOnce = false
})
}
return true
}
if (this.isCurrentScene(Constants.EXCHANGE_QUOTE_SCENE)) {
Actions.popTo(Constants.EXCHANGE_SCENE)
return true
}
if (this.isCurrentScene(Constants.PLUGIN_VIEW)) {
handlePluginBack()
return true
}
Actions.pop()
return true
}
}
onDone={() => Actions.popTo(WALLET_LIST_SCENE)}
image={<img style="{[styles.currencyLogo,">}
const popToRoot = () => {
Actions.popTo('launch');
};
const popToLogin2 = () => {
Actions.popTo('loginModal2');
};
const popToRoot = () => {
Actions.popTo("launch")
};
.catch(async error => {
await showModal(errorModal(s.strings.create_wallet_failed, error))
Actions.popTo(Constants.WALLET_LIST_SCENE)
dispatch({ type: 'UI/WALLETS/CREATE_WALLET_FAILURE' })
})
}