aaaaaaaaaaaaaaaaaaaaaaaaaaaa
This commit is contained in:
parent
cceb78f7c3
commit
9ef748a703
40
src/App.tsx
40
src/App.tsx
@ -5,7 +5,7 @@
|
||||
* @format
|
||||
*/
|
||||
import * as React from 'react';
|
||||
import { NavigationContainer } from '@react-navigation/native';
|
||||
import { NavigationContainer, StackActions } from '@react-navigation/native';
|
||||
import type { PropsWithChildren } from 'react';
|
||||
import {
|
||||
SafeAreaView,
|
||||
@ -17,23 +17,45 @@ import {
|
||||
View,
|
||||
} from 'react-native';
|
||||
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
import ClipViewLocal from './clip/ClipViewLocal';
|
||||
import ClipViewRemote from './clip/ClipViewRemote';
|
||||
import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';
|
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
||||
import SignUp from './auth/SignUp';
|
||||
import SignIn from './auth/SignIn';
|
||||
|
||||
const Stack = createMaterialBottomTabNavigator();
|
||||
const Stack = createNativeStackNavigator();
|
||||
const Tab = createMaterialBottomTabNavigator();
|
||||
|
||||
function Clip() {
|
||||
return (
|
||||
<Tab.Navigator>
|
||||
<Tab.Screen name="Local" options={{ title: 'local' }}>
|
||||
{(props) => <ClipViewLocal navigation={props.navigation} type={"local"} />}
|
||||
</Tab.Screen>
|
||||
<Tab.Screen name="Remote" options={{ title: 'remote' }}>
|
||||
{(props) => <ClipViewRemote navigation={props.navigation} type={"remote"} />}
|
||||
</Tab.Screen>
|
||||
</Tab.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
function Auth() {
|
||||
return <Tab.Navigator>
|
||||
<Tab.Screen component={SignIn} name="Login" options={{ title: 'Sign In' }} />
|
||||
<Tab.Screen component={SignUp} name="Register" options={{ title: 'Sign Up' }} />
|
||||
</Tab.Navigator>;
|
||||
}
|
||||
|
||||
function App(): JSX.Element {
|
||||
return (
|
||||
<NavigationContainer>
|
||||
<Stack.Navigator>
|
||||
<Stack.Screen name="Remote" options={{ title: 'remote' }}>
|
||||
{(props) => <ClipViewRemote navigation={props.navigation} type={"remote"} />}
|
||||
</Stack.Screen>
|
||||
<Stack.Screen name="Local" options={{ title: 'local' }}>
|
||||
{(props) => <ClipViewLocal navigation={props.navigation} type={"local"} />}
|
||||
</Stack.Screen>
|
||||
{/*-------------------------------------------*/}
|
||||
<Stack.Screen component={Auth} name="Authentification" options={{title: "Authentification"}} />
|
||||
{/*-------------------------------------------*/}
|
||||
<Stack.Screen component={Clip} name="Clipboards" options={{title: 'Clipboard'}}/>
|
||||
{/*-------------------------------------------*/}
|
||||
</Stack.Navigator>
|
||||
</NavigationContainer>
|
||||
);
|
||||
|
23
src/auth/SignIn.tsx
Normal file
23
src/auth/SignIn.tsx
Normal file
@ -0,0 +1,23 @@
|
||||
import React from 'react';
|
||||
import { View, Text, Button, TextInput } from 'react-native';
|
||||
|
||||
|
||||
export default class SignIn extends React.Component<any, any> {
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = {
|
||||
clips: []
|
||||
}
|
||||
}
|
||||
|
||||
render(): React.ReactNode {
|
||||
return (
|
||||
<View>
|
||||
<Text>Sign In</Text>
|
||||
<TextInput placeholder="Input" />
|
||||
<Button title="Sign In" onPress={() => this.props.navigation.navigate('ClipList')} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
49
src/auth/SignUp.tsx
Normal file
49
src/auth/SignUp.tsx
Normal file
@ -0,0 +1,49 @@
|
||||
import axios from 'axios';
|
||||
import React from 'react';
|
||||
import { View, Text, Button, TextInput } from 'react-native';
|
||||
|
||||
|
||||
|
||||
export default class SignUp extends React.Component<any, any> {
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = {
|
||||
clips: [],
|
||||
username: '',
|
||||
password: ''
|
||||
}
|
||||
this.updateUsername = this.updateUsername.bind(this);
|
||||
this.updatePassword = this.updatePassword.bind(this);
|
||||
this.signIn = this.signIn.bind(this);
|
||||
}
|
||||
|
||||
async signIn() {
|
||||
const { data, status } = await axios.put("http://notifysync.simailadjalim.fr/user",
|
||||
{ email: this.state.username, password: this.state.password });
|
||||
if (status === 200) {
|
||||
const { data, status } = await axios.post("http://notifysync.simailadjalim.fr/user",
|
||||
{ email: this.state.username, password: this.state.password });
|
||||
this.props.navigation.navigate('ClipList');
|
||||
}
|
||||
}
|
||||
|
||||
updateUsername(event: any){
|
||||
this.setState({username: event.target.value});
|
||||
}
|
||||
|
||||
updatePassword(event: any){
|
||||
this.setState({password: event.target.value});
|
||||
}
|
||||
|
||||
render(): React.ReactNode {
|
||||
return (
|
||||
<View>
|
||||
<Text>Sign Up</Text>
|
||||
<TextInput placeholder="Pseudo" value={this.state.username} onChange={this.updateUsername}/>
|
||||
<TextInput placeholder="Mot de Passe" value={this.state.password} onChange={this.updatePassword}/>
|
||||
<Button title="Sign Up" onPress={this.signIn} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user