Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React, {Component} from 'react';
import {View, Text, StyleSheet, TextInput,StatusBar} from 'react-native';
import {connect} from 'react-redux'; // 引入connect函数
import * as loginAction from './loginAction';// 导入action方法
import {NavigationActions, StackActions} from 'react-navigation';
import {THEME_BACKGROUND, THEME_LABEL, THEME_TEXT} from '../../assets/css/color';
import CButton from '../../common/button';
// 清空导航记录,跳转到首页
const resetAction = StackActions.reset({
index: 0,
actions: [
NavigationActions.navigate({routeName: 'Main'})
]
});
class LoginPage extends Component {
static navigationOptions = {
header: null
};
mobile = '13510005217';
password = '123456';
constructor(props) {
super(props);
this.state = {message: ''};
}
index: 0,
actions: [NavigationActions.init({
routeName: 'Tab',
params: {
user: this.state.user,
partner: this.state.partner,
timestamp: this.state.user.timestamp
}
})]
})
this.props.navigation.dispatch(resetAction)
} else {
const resetAction = NavigationActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'LoginPage' })
]
})
this.props.navigation.dispatch(resetAction)
}
}).catch(error => { })
}
{
if (params.backTo) {
navigation.dispatch(NavigationActions.navigate({ routeName: params.backTo }))
} else {
navigation.dispatch(NavigationActions.back())
}
}} />
export const resetNavigationToRoute = (
routeName: string,
navigation: NavigationScreenProp,
) => {
const navigate = NavigationActions.navigate({ routeName });
const reset = StackActions.reset({
index: 0,
actions: [navigate],
key: null,
});
navigation.dispatch(reset);
};
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View,TouchableHighlight,Alert,Button,Animated} from 'react-native';
import { createStackNavigator, createAppContainer,NavigationActions } from 'react-navigation';
import FadeInView from '../js/FadeInView.js'
const navigateAction = NavigationActions.navigate({
routeName: 'Page_05_p',
params: {},
action: NavigationActions.navigate({ routeName: 'Page_04_p' }),
});
export default class Page_04 extends React.Component {
render() {
return (
async componentDidMount () {
const { auth } = this.props
await auth.isAuthenticated()
const resetAction = NavigationActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: 'home' })],
});
this.props.navigation.dispatch(resetAction)
}
if (!this.routes[routeName]) {
throw `no such route ${routeName}`;
}
if (this.rootRoutes.includes(routeName)) {
flushStoragePart({lastRoute: routeName});
}
const newRoute = Object.assign({}, this.routes[routeName]);
newRoute.props = Object.assign({}, newRoute.props, props);
if (newRoute.type === 'reset' || forceReset) {
return this._navigator.dispatch(StackActions.reset({
index: 0,
actions: [NavigationActions.navigate({routeName, params: newRoute.props, key: Math.random().toString()})]
}));
}
this._navigator.dispatch(NavigationActions.navigate({
routeName,
params: newRoute.props,
key: Math.random().toString()
}));
}
function* deleteProperty(action) {
try {
const state = yield select();
const apiToken = AUTH_SELECTORS.getAuthToken(state);
if (isEmpty(apiToken)) {
yield put(APP_ACTIONS.setNotification('Please Login', 'error'));
return yield put(
NavigationActions.navigate({
routeName: 'Login',
}),
);
}
const urlParams = `?api_token=${apiToken}`;
const response = yield call(API.deleteProperty, urlParams, action.params);
yield put({
type: ACTION_TYPES.PROPERTY_DELETE_SUCCESS,
payload: response,
});
yield put(APP_ACTIONS.setNotification('Property Deleted', 'success'));
} catch (error) {
yield put({type: ACTION_TYPES.PROPERTY_DELETE_FAILURE, error});
}
}
async resetApp() {
await this.props.connectionStore.resetConnection();
await this.props.masterPasswordStore.reset();
await this.props.vaultStore.reset();
const resetAction = StackActions.reset({
index: 0,
key: null,
actions: [
NavigationActions.navigate({ routeName: 'LoginScreen', params: { resetOrder: 1 }})
]
});
this.props.navigation.dispatch(resetAction);
}
export function showAccountIssues() {
return NavigationActions.navigate({
routeName: 'AccountIssues',
});
}