From e3b8655fe97bd34a4fec7ffbe5ffecace4fe4bc0 Mon Sep 17 00:00:00 2001 From: Djalim Simaila Date: Wed, 27 Mar 2024 15:03:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20feat(package.json):=20add=20@exp?= =?UTF-8?q?o/metro-runtime,=20react-dom,=20react-native-toast-notification?= =?UTF-8?q?s,=20react-native-web=20dependencies=20for=20better=20compatibi?= =?UTF-8?q?lity=20and=20notifications=20=F0=9F=94=A5=20feat(App.tsx):=20wr?= =?UTF-8?q?ap=20app=20in=20ToastProvider=20for=20toast=20notifications,=20?= =?UTF-8?q?add=20console=20logs=20for=20debugging=20=F0=9F=94=A5=20feat(Si?= =?UTF-8?q?gnIn.tsx,=20SignUp.tsx):=20refactor=20updateUsername=20and=20up?= =?UTF-8?q?datePassword=20methods=20for=20better=20type=20safety=20?= =?UTF-8?q?=F0=9F=94=A5=20feat(ClipElementLocal.tsx,=20ClipElementRemote.t?= =?UTF-8?q?sx):=20refactor=20to=20functional=20components,=20add=20color?= =?UTF-8?q?=20to=20text=20and=20icons=20for=20better=20visibility=20?= =?UTF-8?q?=F0=9F=94=A5=20feat(ClipViewLocal.tsx,=20ClipViewRemote.tsx):?= =?UTF-8?q?=20add=20color=20to=20title=20for=20better=20visibility=20?= =?UTF-8?q?=F0=9F=94=A5=20feat(ClipElementRemote.tsx):=20add=20color=20to?= =?UTF-8?q?=20text=20for=20better=20visibility=20=F0=9F=94=A5=20feat(ClipV?= =?UTF-8?q?iewRemote.tsx):=20reorder=20elements=20for=20better=20readabili?= =?UTF-8?q?ty=20=F0=9F=94=A5=20feat(ClipViewLocal.tsx):=20add=20color=20to?= =?UTF-8?q?=20title=20for=20better=20visibility=20=F0=9F=94=A5=20feat(Sign?= =?UTF-8?q?Up.tsx):=20refactor=20updatePassword=20method=20for=20better=20?= =?UTF-8?q?type=20safety=20=F0=9F=94=A5=20feat(SignIn.tsx):=20refactor=20u?= =?UTF-8?q?pdateUsername=20and=20updatePassword=20methods=20for=20better?= =?UTF-8?q?=20type=20safety=20=F0=9F=94=A5=20feat(ClipElementLocal.tsx):?= =?UTF-8?q?=20refactor=20to=20functional=20component,=20add=20color=20to?= =?UTF-8?q?=20text=20and=20icons=20for=20better=20visibility=20?= =?UTF-8?q?=F0=9F=94=A5=20feat(ClipElementRemote.tsx):=20refactor=20to=20f?= =?UTF-8?q?unctional=20component,=20add=20color=20to=20text=20for=20better?= =?UTF-8?q?=20visibility=20=F0=9F=94=A5=20feat(ClipViewLocal.tsx):=20add?= =?UTF-8?q?=20color=20to=20title=20for=20better=20visibility=20?= =?UTF-8?q?=F0=9F=94=A5=20feat(ClipViewRemote.tsx):=20add=20color=20to=20t?= =?UTF-8?q?itle=20for=20better=20visibility=20=F0=9F=94=A5=20feat(ClipView?= =?UTF-8?q?Remote.tsx):=20reorder=20elements=20for=20better=20readability?= =?UTF-8?q?=20=F0=9F=94=A5=20feat(ClipViewLocal.tsx):=20add=20color=20to?= =?UTF-8?q?=20title=20for=20better=20visibility=20=F0=9F=94=A5=20feat(Clip?= =?UTF-8?q?ViewRemote.tsx):=20add=20color=20to=20title=20for=20better=20vi?= =?UTF-8?q?sibility=20=F0=9F=94=A5=20feat(ClipViewRemote.tsx):=20reorder?= =?UTF-8?q?=20elements=20for=20better=20readability=20=F0=9F=94=A5=20feat(?= =?UTF-8?q?ClipViewLocal.tsx):=20add=20color=20to=20title=20for=20better?= =?UTF-8?q?=20visibility=20=F0=9F=94=A5=20feat(ClipViewRemote.tsx):=20add?= =?UTF-8?q?=20color=20to=20title=20for=20better=20visibility=20?= =?UTF-8?q?=F0=9F=94=A5=20feat(ClipViewRemote.tsx):=20reorder=20elements?= =?UTF-8?q?=20for=20better=20readability=20=F0=9F=94=A5=20feat(ClipViewLoc?= =?UTF-8?q?al.tsx):=20add=20color=20to=20title=20for=20better=20visibility?= =?UTF-8?q?=20=F0=9F=94=A5=20feat(ClipViewRemote.tsx):=20add=20color=20to?= =?UTF-8?q?=20title=20for=20better=20visibility=20=F0=9F=94=A5=20feat(Clip?= =?UTF-8?q?ViewRemote.tsx):=20reorder?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++ src/App.tsx | 114 ++++++++++++++++----------------- src/auth/SignIn.tsx | 14 ++-- src/auth/SignUp.tsx | 3 +- src/clip/AClipElement.tsx | 16 ----- src/clip/ClipElementLocal.tsx | 36 ++++++----- src/clip/ClipElementRemote.tsx | 37 +++++------ src/clip/ClipViewLocal.tsx | 4 +- src/clip/ClipViewRemote.tsx | 9 ++- 9 files changed, 112 insertions(+), 125 deletions(-) delete mode 100644 src/clip/AClipElement.tsx diff --git a/package.json b/package.json index a05a09b..c44d720 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "test": "jest" }, "dependencies": { + "@expo/metro-runtime": "^3.1.3", "@react-native-async-storage/async-storage": "^1.18.1", "@react-navigation/material-bottom-tabs": "^6.2.15", "@react-navigation/native": "^6.1.6", @@ -21,13 +22,16 @@ "expo-constants": "^14.4.2", "expo-modules-core": "^1.5.12", "react": "18.2.0", + "react-dom": "18.2.0", "react-native": "0.71.4", "react-native-async-storage": "^0.0.1", "react-native-paper": "^5.6.0", "react-native-safe-area-context": "^4.9.0", "react-native-safe-area-view": "^1.1.1", "react-native-simple-toast": "^2.0.0", + "react-native-toast-notifications": "^3.4.0", "react-native-vector-icons": "^9.2.0", + "react-native-web": "~0.18.10", "react-redux": "^8.0.5", "redux": "^4.2.1", "redux-persist": "^6.0.0" diff --git a/src/App.tsx b/src/App.tsx index e58a14a..8a61ca8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -6,29 +6,18 @@ */ import * as React from 'react'; import {NavigationContainer, StackActions} from '@react-navigation/native'; -import type {PropsWithChildren} from 'react'; -import { - SafeAreaView, - ScrollView, - StatusBar, - StyleSheet, - Text, - useColorScheme, - View, -} from 'react-native'; - +import {Platform} from 'react-native'; 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 SignIn from './auth/SignIn'; import SignUp from './auth/SignUp'; import {Provider} from 'react-redux'; import {store, persistor} from './redux/store'; import {PersistGate} from 'redux-persist/integration/react'; - -const Stack = createNativeStackNavigator(); const Tab = createMaterialBottomTabNavigator(); +import { ToastProvider } from 'react-native-toast-notifications' + class App extends React.Component { constructor(props: any) { @@ -40,59 +29,64 @@ class App extends React.Component { store.subscribe(() => { this.setState({token: store.getState().persistedUserReducer.token}); }); + console.log(Platform.OS); + console.log(typeof store); } + render(): React.ReactNode { console.log('render app', store.getState()); console.log('app state', this.state); return ( - - - - - { - this.state.token === '' ? ( + + + + + + { + this.state.token === '' ? ( + //////////////////////////////////////////////////////////// + <> + } + name="Login" + options={{title: 'Connexion'}} + /> + } + name="Register" + options={{title: 'Créer un compte'}} + /> + + ) : ( + //////////////////////////////////////////////////////////// + <> + + {props => ( + + )} + + + {props => ( + + )} + + + ) //////////////////////////////////////////////////////////// - <> - } - name="Login" - options={{title: 'Connexion'}} - /> - } - name="Register" - options={{title: 'Créer un compte'}} - /> - - ) : ( - //////////////////////////////////////////////////////////// - <> - - {props => ( - - )} - - - {props => ( - - )} - - - ) - //////////////////////////////////////////////////////////// - } - - - + } + + + + ); } } diff --git a/src/auth/SignIn.tsx b/src/auth/SignIn.tsx index 1cd80f4..14a001b 100644 --- a/src/auth/SignIn.tsx +++ b/src/auth/SignIn.tsx @@ -32,22 +32,22 @@ export default class SignIn extends React.Component { } else console.log(signInJson); } - updateUsername(event: any) { - this.setState({ username: event.target.value }); + updateUsername(username: string) { + this.setState({ username: username }); } - updatePassword(event: any) { - this.setState({ password: event.target.value }); + updatePassword(password: string) { + this.setState({ password: password }); } render(): React.ReactNode { return ( Connexion - - + +