refactor src folder structure
This commit is contained in:
parent
0bfb70af8b
commit
d0e26e2882
30 changed files with 94 additions and 134 deletions
|
@ -10,9 +10,9 @@ import RenderHtml from 'react-native-render-html';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
|
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
import { ThemedView } from '@/lib/components/ThemedView';
|
import { ThemedView } from '@/src/components/themed/ThemedView';
|
||||||
|
|
||||||
export default function CategoryScreen() {
|
export default function CategoryScreen() {
|
||||||
const colorScheme = useColorScheme() ?? 'light';
|
const colorScheme = useColorScheme() ?? 'light';
|
||||||
|
|
|
@ -6,16 +6,16 @@ import DeviceInfo from 'react-native-device-info';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import Ionicons from '@expo/vector-icons/Ionicons';
|
import Ionicons from '@expo/vector-icons/Ionicons';
|
||||||
|
|
||||||
import { ThemedText } from '@/lib/components/ThemedText';
|
import { ThemedText } from '@/src/components/themed/ThemedText';
|
||||||
import { ThemedView } from '@/lib/components/ThemedView';
|
import { ThemedView } from '@/src/components/themed/ThemedView';
|
||||||
import { useToken } from '@/lib/context/AppProvider';
|
import { useToken } from '@/src/context/AppProvider';
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
import { Message } from '@/lib/services/message';
|
import { Message } from '@/src/services/message';
|
||||||
import { Request } from '@/lib/services/request';
|
import { Request } from '@/src/services/request';
|
||||||
import { store } from '@/lib/store/store';
|
import { store } from '@/src/store/store';
|
||||||
import { setSession } from '@/lib/store/dataStore';
|
import { setSession } from '@/src/store/dataStore';
|
||||||
import ThemedInput from '@/lib/components/ThemedInput';
|
import ThemedInput from '@/src/components/themed/ThemedInput';
|
||||||
|
|
||||||
export default function OnboardStartScreen() {
|
export default function OnboardStartScreen() {
|
||||||
const colorScheme = useColorScheme() ?? 'light';
|
const colorScheme = useColorScheme() ?? 'light';
|
||||||
|
|
|
@ -5,16 +5,16 @@ import { DateTimePickerAndroid, DateTimePickerEvent } from '@react-native-commun
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
import { ThemedView } from '@/lib/components/ThemedView';
|
import { ThemedView } from '@/src/components/themed/ThemedView';
|
||||||
import { ThemedText } from '@/lib/components/ThemedText';
|
import { ThemedText } from '@/src/components/themed/ThemedText';
|
||||||
import { Request } from '@/lib/services/request';
|
import { Request } from '@/src/services/request';
|
||||||
import { useToken } from '@/lib/context/AppProvider';
|
import { useToken } from '@/src/context/AppProvider';
|
||||||
import { Message } from '@/lib/services/message';
|
import { Message } from '@/src/services/message';
|
||||||
import { store } from '@/lib/store/store';
|
import { store } from '@/src/store/store';
|
||||||
import { setSession } from '@/lib/store/dataStore';
|
import { setSession } from '@/src/store/dataStore';
|
||||||
import { ThemedIcon } from '@/lib/components/ThemedIcon';
|
import { ThemedIcon } from '@/src/components/themed/ThemedIcon';
|
||||||
|
|
||||||
export default function CategoryScreen() {
|
export default function CategoryScreen() {
|
||||||
const colorScheme = useColorScheme() ?? 'light';
|
const colorScheme = useColorScheme() ?? 'light';
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Tabs } from 'expo-router';
|
import { Tabs } from 'expo-router';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { TabBarIcon } from '@/lib/components/navigation/TabBarIcon';
|
import { TabBarIcon } from '@/src/components/navigation/TabBarIcon';
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
|
|
||||||
export default function TabLayout() {
|
export default function TabLayout() {
|
||||||
const colorScheme = useColorScheme();
|
const colorScheme = useColorScheme();
|
||||||
|
|
|
@ -14,14 +14,14 @@ import { AutocompleteDropdown } from 'react-native-autocomplete-dropdown';
|
||||||
import Modal from "react-native-modal";
|
import Modal from "react-native-modal";
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { ThemedText } from '@/lib/components/ThemedText';
|
import { ThemedText } from '@/src/components/themed/ThemedText';
|
||||||
import { ThemedView } from '@/lib/components/ThemedView';
|
import { ThemedView } from '@/src/components/themed/ThemedView';
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
import { Request } from '@/lib/services/request';
|
import { Request } from '@/src/services/request';
|
||||||
import List from '@/lib/components/List';
|
import List from '@/src/components/List';
|
||||||
import { store } from '@/lib/store/store';
|
import { store } from '@/src/store/store';
|
||||||
import { setViewCategory } from '@/lib/store/dataStore';
|
import { setViewCategory } from '@/src/store/dataStore';
|
||||||
|
|
||||||
export default function ExploreScreen() {
|
export default function ExploreScreen() {
|
||||||
const colorScheme = useColorScheme() ?? 'light';
|
const colorScheme = useColorScheme() ?? 'light';
|
||||||
|
|
|
@ -7,15 +7,15 @@ import { useSelector } from 'react-redux';
|
||||||
import { LogLevel, OneSignal } from 'react-native-onesignal';
|
import { LogLevel, OneSignal } from 'react-native-onesignal';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { ThemedText } from '@/lib/components/ThemedText';
|
import { ThemedText } from '@/src/components/themed/ThemedText';
|
||||||
import { ThemedView } from '@/lib/components/ThemedView';
|
import { ThemedView } from '@/src/components/themed/ThemedView';
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
import { useToken } from '@/lib/context/AppProvider';
|
import { useToken } from '@/src/context/AppProvider';
|
||||||
import { Request } from '@/lib/services/request';
|
import { Request } from '@/src/services/request';
|
||||||
import List from '@/lib/components/List';
|
import List from '@/src/components/List';
|
||||||
import { Message } from '@/lib/services/message';
|
import { Message } from '@/src/services/message';
|
||||||
import { ThemedIcon } from '@/lib/components/ThemedIcon';
|
import { ThemedIcon } from '@/src/components/themed/ThemedIcon';
|
||||||
|
|
||||||
export default function HomeScreen() {
|
export default function HomeScreen() {
|
||||||
const colorScheme = useColorScheme() ?? 'light';
|
const colorScheme = useColorScheme() ?? 'light';
|
||||||
|
|
|
@ -7,12 +7,12 @@ import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
Mapbox.setAccessToken( "pk.eyJ1IjoibWFhcnRlbnZyOTgiLCJhIjoiY2x6ZDFqMGp1MGVyejJrczhqcXpvYm9iYiJ9.XvYcL62dWiJQiFmG6mOoug" );
|
Mapbox.setAccessToken( "pk.eyJ1IjoibWFhcnRlbnZyOTgiLCJhIjoiY2x6ZDFqMGp1MGVyejJrczhqcXpvYm9iYiJ9.XvYcL62dWiJQiFmG6mOoug" );
|
||||||
|
|
||||||
import { ThemedText } from '@/lib/components/ThemedText';
|
import { ThemedText } from '@/src/components/themed/ThemedText';
|
||||||
import { ThemedView } from '@/lib/components/ThemedView';
|
import { ThemedView } from '@/src/components/themed/ThemedView';
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
import List from '@/lib/components/List';
|
import List from '@/src/components/List';
|
||||||
import { Request } from '@/lib/services/request';
|
import { Request } from '@/src/services/request';
|
||||||
|
|
||||||
export default function MapScreen() {
|
export default function MapScreen() {
|
||||||
const colorScheme = useColorScheme() ?? 'light';
|
const colorScheme = useColorScheme() ?? 'light';
|
||||||
|
|
|
@ -13,18 +13,18 @@ import { useTranslation } from 'react-i18next';
|
||||||
import { BottomSheet, BottomSheetRefType } from 'react-native-select-bottom-list';
|
import { BottomSheet, BottomSheetRefType } from 'react-native-select-bottom-list';
|
||||||
|
|
||||||
|
|
||||||
import { ThemedText } from '@/lib/components/ThemedText';
|
import { ThemedText } from '@/src/components/themed/ThemedText';
|
||||||
import { ThemedView } from '@/lib/components/ThemedView';
|
import { ThemedView } from '@/src/components/themed/ThemedView';
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
import { useToken } from '@/lib/context/AppProvider';
|
import { useToken } from '@/src/context/AppProvider';
|
||||||
import { Message } from '@/lib/services/message';
|
import { Message } from '@/src/services/message';
|
||||||
import { Request } from '@/lib/services/request';
|
import { Request } from '@/src/services/request';
|
||||||
import CustomModal from '@/lib/components/EditModal';
|
import CustomModal from '@/src/components/EditModal';
|
||||||
import { store } from '@/lib/store/store';
|
import { store } from '@/src/store/store';
|
||||||
import { setSession, setReloadCalendar } from '@/lib/store/dataStore';
|
import { setSession, setReloadCalendar } from '@/src/store/dataStore';
|
||||||
import { ThemedIcon } from '@/lib/components/ThemedIcon';
|
import { ThemedIcon } from '@/src/components/themed/ThemedIcon';
|
||||||
import List from '@/lib/components/List';
|
import List from '@/src/components/List';
|
||||||
|
|
||||||
export default function SettingsScreen() {
|
export default function SettingsScreen() {
|
||||||
const colorScheme = useColorScheme() ?? 'light';
|
const colorScheme = useColorScheme() ?? 'light';
|
||||||
|
@ -266,20 +266,14 @@ export default function SettingsScreen() {
|
||||||
]}
|
]}
|
||||||
viewStyle={styles.languagesList}
|
viewStyle={styles.languagesList}
|
||||||
renderItem={(item: any, index: any) => (
|
renderItem={(item: any, index: any) => (
|
||||||
<ThemedView>
|
|
||||||
{item.key === language ?
|
|
||||||
(
|
|
||||||
<TouchableOpacity style={styles.languagesListItem} key={index} onPress={() => changeLanguage( item.key )}>
|
<TouchableOpacity style={styles.languagesListItem} key={index} onPress={() => changeLanguage( item.key )}>
|
||||||
<ThemedText type="defaultSemiBold">{item.name}</ThemedText>
|
<ThemedText type={item.key === language ? 'defaultSemiBold' : 'default'}>{item.name}</ThemedText>
|
||||||
|
|
||||||
|
{item.key === language &&
|
||||||
<ThemedIcon name="checkmark" size={18}/>
|
<ThemedIcon name="checkmark" size={18}/>
|
||||||
</TouchableOpacity>
|
|
||||||
) : (
|
|
||||||
<TouchableOpacity style={styles.languagesListItem} key={index} onPress={() => changeLanguage( item.key )}>
|
|
||||||
<ThemedText type="default">{item.name}</ThemedText>
|
|
||||||
</TouchableOpacity>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
</ThemedView>
|
</TouchableOpacity>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
|
|
|
@ -7,9 +7,9 @@ import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native
|
||||||
import Toast from 'react-native-toast-message';
|
import Toast from 'react-native-toast-message';
|
||||||
import { AutocompleteDropdownContextProvider } from 'react-native-autocomplete-dropdown';
|
import { AutocompleteDropdownContextProvider } from 'react-native-autocomplete-dropdown';
|
||||||
|
|
||||||
import { AppProvider } from '@/lib/context/AppProvider';
|
import { AppProvider } from '@/src/context/AppProvider';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
import { store } from '@/lib/store/store';
|
import { store } from '@/src/store/store';
|
||||||
|
|
||||||
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
// Prevent the splash screen from auto-hiding before asset loading is complete.
|
||||||
SplashScreen.preventAutoHideAsync();
|
SplashScreen.preventAutoHideAsync();
|
||||||
|
|
|
@ -2,14 +2,14 @@ import React, { useEffect } from 'react';
|
||||||
import { Redirect, useRouter } from 'expo-router';
|
import { Redirect, useRouter } from 'expo-router';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import '@/lib/localization/i18n';
|
import '@/src/localization/i18n';
|
||||||
|
|
||||||
import { ThemedText } from '@/lib/components/ThemedText';
|
import { ThemedText } from '@/src/components/themed/ThemedText';
|
||||||
import { ThemedView } from '@/lib/components/ThemedView';
|
import { ThemedView } from '@/src/components/themed/ThemedView';
|
||||||
import { useToken } from '@/lib/context/AppProvider';
|
import { useToken } from '@/src/context/AppProvider';
|
||||||
import { Request } from '@/lib/services/request';
|
import { Request } from '@/src/services/request';
|
||||||
import { store } from '@/lib/store/store';
|
import { store } from '@/src/store/store';
|
||||||
import { setSession } from '@/lib/store/dataStore';
|
import { setSession } from '@/src/store/dataStore';
|
||||||
|
|
||||||
export default function OnboardStartScreen() {
|
export default function OnboardStartScreen() {
|
||||||
const { token, isLoading } = useToken();
|
const { token, isLoading } = useToken();
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
import * as React from 'react';
|
|
||||||
import renderer from 'react-test-renderer';
|
|
||||||
|
|
||||||
import { ThemedText } from '../ThemedText';
|
|
||||||
|
|
||||||
it( `renders correctly`, () => {
|
|
||||||
const tree = renderer.create( <ThemedText>Snapshot test!</ThemedText> ).toJSON();
|
|
||||||
|
|
||||||
expect( tree ).toMatchSnapshot();
|
|
||||||
} );
|
|
|
@ -1,24 +0,0 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`renders correctly 1`] = `
|
|
||||||
<Text
|
|
||||||
style={
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"color": "#11181C",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fontSize": 16,
|
|
||||||
"lineHeight": 24,
|
|
||||||
},
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
]
|
|
||||||
}
|
|
||||||
>
|
|
||||||
Snapshot test!
|
|
||||||
</Text>
|
|
||||||
`;
|
|
|
@ -7,11 +7,11 @@ import {
|
||||||
import Modal from "react-native-modal";
|
import Modal from "react-native-modal";
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
import { ThemedView } from '@/lib/components/ThemedView';
|
import { ThemedView } from '@/src/components/themed/ThemedView';
|
||||||
import { ThemedText } from '@/lib/components/ThemedText';
|
import { ThemedText } from '@/src/components/themed/ThemedText';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
import ThemedInput from '@/lib/components/ThemedInput';
|
import ThemedInput from '@/src/components/themed/ThemedInput';
|
||||||
|
|
||||||
interface Field {
|
interface Field {
|
||||||
name: string;
|
name: string;
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ViewStyle } from 'react-native';
|
import { ViewStyle } from 'react-native';
|
||||||
import { ThemedView } from '@/lib/components/ThemedView';
|
import { ThemedView } from '@/src/components/themed/ThemedView';
|
||||||
|
|
||||||
interface ListProps {
|
interface ListProps {
|
||||||
data: any;
|
data: any;
|
|
@ -3,8 +3,8 @@
|
||||||
import Ionicons from '@expo/vector-icons/Ionicons';
|
import Ionicons from '@expo/vector-icons/Ionicons';
|
||||||
import { type IconProps } from '@expo/vector-icons/build/createIconSet';
|
import { type IconProps } from '@expo/vector-icons/build/createIconSet';
|
||||||
import { type ComponentProps } from 'react';
|
import { type ComponentProps } from 'react';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
|
|
||||||
export function ThemedIcon({ style, ...rest }: IconProps<ComponentProps<typeof Ionicons>['name']>) {
|
export function ThemedIcon({ style, ...rest }: IconProps<ComponentProps<typeof Ionicons>['name']>) {
|
||||||
const colorScheme = useColorScheme() ?? 'light';
|
const colorScheme = useColorScheme() ?? 'light';
|
|
@ -1,9 +1,9 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { TextInput, StyleSheet, TextInputProps, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
import { TextInput, StyleSheet, TextInputProps, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
||||||
import { ThemedView } from '@/lib/components/ThemedView';
|
import { ThemedView } from '@/src/components/themed/ThemedView';
|
||||||
import { ThemedText } from '@/lib/components/ThemedText';
|
import { ThemedText } from '@/src/components/themed/ThemedText';
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
import { useColorScheme } from '@/lib/hooks/useColorScheme';
|
import { useColorScheme } from '@/src/hooks/useColorScheme';
|
||||||
|
|
||||||
interface InputComponentProps extends TextInputProps {
|
interface InputComponentProps extends TextInputProps {
|
||||||
label?: string;
|
label?: string;
|
|
@ -1,6 +1,6 @@
|
||||||
import { Text, type TextProps, StyleSheet } from 'react-native';
|
import { Text, type TextProps, StyleSheet } from 'react-native';
|
||||||
|
|
||||||
import { useThemeColor } from '@/lib/hooks/useThemeColor';
|
import { useThemeColor } from '@/src/hooks/useThemeColor';
|
||||||
|
|
||||||
export type ThemedTextProps = TextProps & {
|
export type ThemedTextProps = TextProps & {
|
||||||
lightColor?: string;
|
lightColor?: string;
|
|
@ -1,6 +1,6 @@
|
||||||
import { View, type ViewProps } from 'react-native';
|
import { View, type ViewProps } from 'react-native';
|
||||||
|
|
||||||
import { useThemeColor } from '@/lib/hooks/useThemeColor';
|
import { useThemeColor } from '@/src/hooks/useThemeColor';
|
||||||
|
|
||||||
export type ThemedViewProps = ViewProps & {
|
export type ThemedViewProps = ViewProps & {
|
||||||
lightColor?: string;
|
lightColor?: string;
|
|
@ -1,5 +1,5 @@
|
||||||
import { createContext, PropsWithChildren, useContext } from "react";
|
import { createContext, PropsWithChildren, useContext } from "react";
|
||||||
import { useStorageState } from '@/lib/context/UseStorageState';
|
import { useStorageState } from '@/src/context/UseStorageState';
|
||||||
|
|
||||||
type TokenType = {
|
type TokenType = {
|
||||||
token: string | null;
|
token: string | null;
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import { useColorScheme } from 'react-native';
|
import { useColorScheme } from 'react-native';
|
||||||
|
|
||||||
import { Colors } from '@/lib/constants/Colors';
|
import { Colors } from '@/src/constants/Colors';
|
||||||
|
|
||||||
export function useThemeColor(
|
export function useThemeColor(
|
||||||
props: { light?: string; dark?: string },
|
props: { light?: string; dark?: string },
|
Loading…
Add table
Add a link
Reference in a new issue