Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

/**
Expand Down
12 changes: 6 additions & 6 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2132,7 +2132,8 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNVectorIcons (10.2.0):
- SocketRocket (0.7.1)
- Teleport (0.3.0):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -2156,7 +2157,6 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- SocketRocket (0.7.1)
- Unistyles (3.0.10):
- DoubleConversion
- glog
Expand Down Expand Up @@ -2269,7 +2269,7 @@ DEPENDENCIES:
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
- RNSVG (from `../node_modules/react-native-svg`)
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
- Teleport (from `../node_modules/react-native-teleport`)
- Unistyles (from `../node_modules/react-native-unistyles`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

Expand Down Expand Up @@ -2443,8 +2443,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-screens"
RNSVG:
:path: "../node_modules/react-native-svg"
RNVectorIcons:
:path: "../node_modules/react-native-vector-icons"
Teleport:
:path: "../node_modules/react-native-teleport"
Unistyles:
:path: "../node_modules/react-native-unistyles"
Yoga:
Expand Down Expand Up @@ -2533,8 +2533,8 @@ SPEC CHECKSUMS:
RNReanimated: 730ffe6cf7b931f78b795e6b6e0920dcab9c8beb
RNScreens: 5483638048b69594b925071d6119de6eb6072e96
RNSVG: ba53827311fd9f8a14e06626365a749ce7713975
RNVectorIcons: 941a39b5d3b9d8cf8ac2e2fc09b07bfafbcf9796
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Teleport: 402604f5a4f762d39ce519ecc8d1925fe7d040f8
Unistyles: c4da33859831bf03bd650835677f7d08b2a6755b
Yoga: 9773f1327b258fa449988c2e42fbb7cbdf655d96

Expand Down
10 changes: 8 additions & 2 deletions ios/ReactNativeTemplate.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,10 @@
"-DFOLLY_CFG_NO_COROUTINES=1",
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
);
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
Expand Down Expand Up @@ -507,7 +510,10 @@
"-DFOLLY_CFG_NO_COROUTINES=1",
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
);
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"react-native-svg": "15.12.1",
"react-native-teleport": "^0.3.0",
"react-native-unistyles": "3.0.10",
"react-native-vector-icons": "10.2.0",
"sonner-native": "0.21.1",
"zod": "3.24.4"
},
Expand Down
16 changes: 15 additions & 1 deletion src/modules/Common/features/useRootNavigator.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { DefaultTheme, Theme } from '@react-navigation/native';
import { useEventEmitter } from 'providers';
import { useEffect } from 'react';
import { useUnistyles } from 'react-native-unistyles';
import { useCurrentTheme, useToken } from 'stores';
import { resetAllStores, useCurrentTheme, useToken } from 'stores';

export const useRootNavigator = () => {
const token = useToken();

const currentTheme = useCurrentTheme();

const eventEmitter = useEventEmitter();

const { theme } = useUnistyles();

const navigationTheme = {
Expand All @@ -26,6 +30,16 @@ export const useRootNavigator = () => {
},
} satisfies Theme;

useEffect(() => {
const listener = eventEmitter.addListener('LOGOUT', () => {
resetAllStores();
});

return () => {
listener.removeListener('LOGOUT');
};
}, []);

return {
currentTheme,
token,
Expand Down
15 changes: 6 additions & 9 deletions src/navigation/BottomTabBarNavigator.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useMemo } from 'react';
import React from 'react';
import { Text } from 'react-native';
import { IconName } from 'react-native-vector-icons';
import { IconName } from '@react-native-vector-icons/icomoon';
import { StyleSheet, useUnistyles } from 'react-native-unistyles';
import { Icon } from 'ui';
import { RouteService, RouteType, Routes } from 'services';
Expand All @@ -18,13 +18,10 @@ export const BottomTabBarNavigator: React.FC = () => {

const { t } = useTranslation();

const titles: Record<string, string> = useMemo(
() => ({
[Routes.ALERTS_NAVIGATOR]: t('screens.alerts'),
[Routes.PROFILE_NAVIGATOR]: t('screens.account'),
}),
[t],
);
const titles: Record<string, string> = {
[Routes.ALERTS_NAVIGATOR]: t('screens.alerts'),
[Routes.PROFILE_NAVIGATOR]: t('screens.account'),
};

const handleLongPress = (routeName: RouteType) => {
RouteService.navigate(routeName);
Expand Down
5 changes: 4 additions & 1 deletion src/shared/api/baseQuery.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Config from 'react-native-config';
import { ExceptionService, ToastService } from 'services';
import { eventEmitter, ExceptionService, ToastService } from 'services';
import { getAuthStoreInstance, resetAllStores } from 'stores';
import axios from 'axios';
import { Mutex } from 'async-mutex';
Expand Down Expand Up @@ -33,6 +33,9 @@ export const baseQuery = createAxiosClient({
ToastService.onDanger({
title: ExceptionService.errorResolver(error),
});

eventEmitter.emit('LOGOUT');

resetAllStores();
} finally {
release();
Expand Down
2 changes: 1 addition & 1 deletion src/shared/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export * from './useLatest';
export * from './useAppStateEvent';
export * from './useCombinedRef';
export * from './useDebounce';
export * from './useTypedRoute';
export * from './useDebug';
export * from './useTypedRoute';
9 changes: 6 additions & 3 deletions src/shared/hooks/useTypedRoute.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { RouteProp, useRoute } from '@react-navigation/native';
import { useRoute, RouteProp } from '@react-navigation/native';
import { RootStackParamList } from 'services';

export const useTypedRoute = <T extends keyof RootStackParamList>() =>
useRoute<RouteProp<RootStackParamList, T>>();
export const useTypedRoute = <T extends keyof RootStackParamList>(
_: T,
): RouteProp<RootStackParamList, T> => {
return useRoute<RouteProp<RootStackParamList, T>>();
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const useEventEmitter = () => {
const context = useContext(EventContext);

if (!context) {
throw new Error('useEventEmiiter must be used within an EventProvider');
throw new Error('useEventEmitter must be used within an EventProvider');
}

return context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { EventEmitter } from 'eventemitter3';

export const EVENT_EMITTER_ACTIONS = {
SELECT_COUNTRY_CODE: 'SELECT_COUNTRY_CODE',
LOGOUT: 'LOGOUT',
} as const;

export type EmitterActionsType = keyof typeof EVENT_EMITTER_ACTIONS;

export type EventPayloads = {
[EVENT_EMITTER_ACTIONS.SELECT_COUNTRY_CODE]: string;
[EVENT_EMITTER_ACTIONS.LOGOUT]: void;
};

export class TypedEventEmitter extends EventEmitter<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* eslint-disable import/no-unresolved */
import { IconName as BaseName } from 'assets/resources/selection.json';
import { IconProps } from 'react-native-vector-icons/Icon';

declare module 'react-native-vector-icons' {
declare module '@react-native-vector-icons/icomoon' {
export type IconName = BaseName;

export type Props = IconProps;
}
6 changes: 3 additions & 3 deletions src/shared/ui/Icon/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react';
import { withUnistyles } from 'react-native-unistyles';
import { IconName, Props } from 'react-native-vector-icons';
import createIconSet, { IconName } from '@react-native-vector-icons/icomoon';
import { ColorsType } from 'themes';
import createIconSet from '@react-native-vector-icons/icomoon';
import { ViewProps } from 'react-native';

export const IcomoonConfig = require('../../../assets/resources/selection.json');

const IcomoonIcon = createIconSet(IcomoonConfig);

const DEFAULT_ICON_SIZE = 16;

interface BaseProps extends Props {
interface BaseProps extends ViewProps {
name: IconName;
size?: number;
color?: ColorsType;
Expand Down
Loading