🔧 refactor(App.tsx): import AppRegistry, Platform from react-native for better platform detection 🔧 refactor(App.tsx): import persistor from redux store to persist redux state 🔧 refactor(App.tsx): wrap app in PersistGate to persist and rehydrate a redux store 🔧 refactor(App.tsx): change initial token state to use token from redux store 🔧 refactor(app.json): add package name to app.json for unique app identification 🔧 refactor(package.json): change android and ios scripts to use expo run:android and expo run:ios 🔧 refactor(package.json): add react-native-android-notification-listener and react-native-pager-view dependencies 🔧 refactor(package.json): add redux-persist-expo-filesystem for redux state persistence 🔧 refactor(ClipElementLocal.tsx): remove unnecessary whitespace 🔧 refactor(ClipList.tsx): replace ScrollView with FlatList for better performance 🔧 refactor(ClipList.tsx): use nanoid for unique key generation in FlatList 🔧 refactor(ClipView.tsx): add Button for compact layout 🔧 refactor(ClipView.tsx): adjust Searchbar style for better layout 🔧 refactor(ClipViewLocal.tsx): use localClipAddToList action for adding to local clip list 🔧 refactor(ClipViewLocal.tsx): set initial clips state to use localClip from redux store 🔧 refactor(ClipViewRemote.tsx): use remoteClipAddToList action for adding to remote clip list 🔧 refactor(ClipViewRemote.tsx): set initial clips state to use remoteClip from redux store 🔧 refactor(Clips.tsx): add signout function to clear all redux states on signout 🔧 refactor(Clips.tsx): add Notifications to Drawer 🔧 refactor(Clips.tsx): replace ClipView with NotifView for notif active state 🔧 refactor(reducers.tsx): rename localAddToList to localClipAddToList for better semantics 🔧 refactor(reducers.tsx): rename remoteAddToList to remoteClipAddToList for better semantics 🔧 refactor(reducers.tsx): add localNotifsSlice and remoteNotifsSlice for handling local and remote notifications
69 lines
2.4 KiB
TypeScript
69 lines
2.4 KiB
TypeScript
import 'react-native-gesture-handler';
|
|
// ^ le bouge pas ca casse tout ^
|
|
import { AppRegistry, Platform } from 'react-native'
|
|
|
|
|
|
import { useState } from "react";
|
|
import { NavigationContainer, DefaultTheme } from '@react-navigation/native';
|
|
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
import { Provider } from 'react-redux';
|
|
import { store,persistor } from './src/redux/store';
|
|
import { PaperProvider } from 'react-native-paper';
|
|
import { ToastProvider } from 'react-native-toast-notifications'
|
|
import AuthPage from './src/pages/Auth';
|
|
import ClipPage from './src/pages/Clips';
|
|
import IntroPage from './src/pages/Intro';
|
|
import { StatusBar } from 'expo-status-bar';
|
|
import { Material3Dracula, ReactNavigationDracula } from './src/themes';
|
|
import { PixelRatio, useWindowDimensions } from 'react-native';
|
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
const Stack = createNativeStackNavigator();
|
|
import { PersistGate } from 'redux-persist/integration/react';
|
|
|
|
|
|
function App(){
|
|
const [token,setToken] = useState(store.getState().user.token);
|
|
const [username,setUsername] = useState("");
|
|
|
|
const {height,width} = useWindowDimensions();
|
|
console.log(width);
|
|
console.log(PixelRatio.get())
|
|
|
|
store.subscribe(()=>{
|
|
let newToken = store.getState().user.token;
|
|
setToken(newToken);
|
|
})
|
|
|
|
return (
|
|
<PaperProvider theme={Material3Dracula}>
|
|
<ToastProvider>
|
|
<Provider store={store}>
|
|
<PersistGate loading={null} persistor={persistor}>
|
|
<StatusBar style="light"/>
|
|
<SafeAreaProvider>
|
|
<NavigationContainer theme={ReactNavigationDracula}>
|
|
<Stack.Navigator>
|
|
{
|
|
token !== "" ? (
|
|
<>
|
|
<Stack.Screen name="Home" component={ClipPage} options={{ headerShown: false }}/>
|
|
</>
|
|
) : (
|
|
<>
|
|
<Stack.Screen name="Intro" component={IntroPage} options={{ headerShown: false }} />
|
|
<Stack.Screen name="SignIn" component={AuthPage} options={{ headerShown: false }} />
|
|
</>
|
|
)
|
|
}
|
|
</Stack.Navigator>
|
|
</NavigationContainer>
|
|
</SafeAreaProvider>
|
|
</PersistGate>
|
|
</Provider>
|
|
</ToastProvider>
|
|
</PaperProvider>
|
|
);
|
|
}
|
|
|
|
export default App;
|