From 7722eba86fbb3e3e76c51bc2409954cfa4d04c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Fri, 31 Mar 2023 00:18:34 +0200 Subject: [PATCH] TabRowNavigator is now quite usable and almost pleasing to look at --- .../components/navigators/TabRowNavigator.tsx | 113 ++++++++---------- front/views/SettingsView.tsx | 6 +- 2 files changed, 53 insertions(+), 66 deletions(-) diff --git a/front/components/navigators/TabRowNavigator.tsx b/front/components/navigators/TabRowNavigator.tsx index e60cbc1..87ab77f 100644 --- a/front/components/navigators/TabRowNavigator.tsx +++ b/front/components/navigators/TabRowNavigator.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { StyleProp, ViewStyle, StyleSheet } from "react-native"; -import { View, Text, Pressable, Box, Row, Icon } from "native-base"; +import { View, Text, Pressable, Box, Row, Icon, Button } from "native-base"; import { createNavigatorFactory, DefaultNavigatorOptions, @@ -12,6 +12,7 @@ import { TabRouterOptions, useNavigationBuilder, } from "@react-navigation/native"; +import TextButton from "../TextButton"; // Props accepted by the view type TabNavigationConfig = { @@ -76,76 +77,62 @@ function TabNavigator({ display: "flex", flexDirection: "column", justifyContent: "flex-start", - width: "300px", + borderRightWidth: 1, + borderRightColor: "lightgray", }, tabBarStyle, ]} > - {state.routes.map((route) => ( - { - const event = navigation.emit({ - type: "tabPress", - target: route.key, - canPreventDefault: true, - data: { - isAlreadyFocused: - route.key === state.routes[state.index]?.key, - }, - }); + {state.routes.map((route) => { + const isSelected = route.key === state.routes[state.index]?.key; + const { options } = descriptors[route.key]; - if (!event.defaultPrevented) { - navigation.dispatch({ - ...CommonActions.navigate(route), - target: state.key, + return ( + + ); + })} {state.routes.map((route, i) => { diff --git a/front/views/SettingsView.tsx b/front/views/SettingsView.tsx index c2b82c0..9ca2ef1 100644 --- a/front/views/SettingsView.tsx +++ b/front/views/SettingsView.tsx @@ -168,9 +168,9 @@ const NotificationsView = ({navigation}) => { - + navigation.navigate('Main')} translate = {{ + translationKey: 'backBtn' + }} /> Push notifications