Initial commit
This commit is contained in:
87
views/Guide/index.jsx
Normal file
87
views/Guide/index.jsx
Normal file
@@ -0,0 +1,87 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
TextInput,
|
||||
TouchableOpacity,
|
||||
Image,
|
||||
StyleSheet,
|
||||
Alert,
|
||||
StatusBar
|
||||
} from 'react-native';
|
||||
|
||||
import { Toast, Button } from '@ant-design/react-native';
|
||||
import { useContextHook } from '@/components/AuthContext/index';
|
||||
|
||||
import AsyncStorage from '@/storage/index';
|
||||
import { useRouter } from '@/hooks/useRouter';
|
||||
|
||||
import {
|
||||
statusBarHeight,
|
||||
paddingTopStatusBarHeight,
|
||||
flexRow,
|
||||
flexColumn,
|
||||
flexSub,
|
||||
flexShrink,
|
||||
flexWrap,
|
||||
flexnoWrap,
|
||||
justifyStart,
|
||||
justifyEnd,
|
||||
justifyCenter,
|
||||
justifyBetween,
|
||||
justifyAround,
|
||||
justifyEvenly,
|
||||
alignItemsStart,
|
||||
alignItemsEnd,
|
||||
alignItemsCenter,
|
||||
alignItemsStretch,
|
||||
positionRelative,
|
||||
positionAbsolute,
|
||||
useStyles,
|
||||
} from '@/assets/styles/css';
|
||||
|
||||
const Index = () => {
|
||||
const { themeColor } = useContextHook();
|
||||
const { linkTo, resetAllRoutes, isFocused } = useRouter();
|
||||
useEffect(() => {
|
||||
const user = AsyncStorage.getItemAsync('user');
|
||||
// 这里请求配置后,再跳转
|
||||
setTimeout(() => {
|
||||
console.log('user', user);
|
||||
if (user && user.token) {
|
||||
resetAllRoutes('Home');
|
||||
} else {
|
||||
resetAllRoutes('Login');
|
||||
}
|
||||
}, 1000);
|
||||
}, [isFocused]);
|
||||
|
||||
return (
|
||||
<View style={[flexSub, {}]}>
|
||||
<View
|
||||
style={[
|
||||
flexSub,
|
||||
justifyCenter,
|
||||
alignItemsCenter,
|
||||
flexRow
|
||||
]}>
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 24,
|
||||
fontWeight: 'bold',
|
||||
backgroundColor: 'red',
|
||||
}}>
|
||||
login111
|
||||
</Text>
|
||||
<Button type="primary" onPress={() => {
|
||||
Toast.show({
|
||||
content: 'Please enter user name',
|
||||
position: 'center',
|
||||
mask: true,
|
||||
});
|
||||
}}>Click me</Button>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
export default Index;
|
||||
Reference in New Issue
Block a user