How to setup Top tabs with expo-router? #294
Replies: 8 comments 7 replies
-
@bhatvikrant Did you get a solution for this. |
Beta Was this translation helpful? Give feedback.
-
Yes, I made use of react-native-tab-view package.
On Tue, 28 Feb 2023 at 2:54 PM, Hudson Luseno ***@***.***> wrote:
@bhatvikrant <https://github.com/bhatvikrant> Did you get a solution for
this.
—
Reply to this email directly, view it on GitHub
<#294 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMDCPMN5ULT6DKXZGP5WQYDWZW73NANCNFSM6AAAAAAVANQYYM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Regards,
Vikrant Bhat
Software Engineer, Razorpay
|
Beta Was this translation helpful? Give feedback.
-
Did you manage to use the directory structure to define your routes? Or did you use the library ( Maybe it is possible to use the Or maybe I've missed something on the documentation about the |
Beta Was this translation helpful? Give feedback.
-
Here's what I'm doing, based on this example, but updated a little: import type {ParamListBase, TabNavigationState} from '@react-navigation/native';
import {createMaterialTopTabNavigator} from '@react-navigation/material-top-tabs';
import type {
MaterialTopTabNavigationOptions,
MaterialTopTabNavigationEventMap,
} from '@react-navigation/material-top-tabs';
import {withLayoutContext} from 'expo-router';
const {Navigator} = createMaterialTopTabNavigator();
export const MaterialTopTabs = withLayoutContext<
MaterialTopTabNavigationOptions,
typeof Navigator,
TabNavigationState<ParamListBase>,
MaterialTopTabNavigationEventMap
>(Navigator); Have not tested yet, but I think that's approximately right. |
Beta Was this translation helpful? Give feedback.
-
Take a look to this project, it's from @EvanBacon himself https://github.com/EvanBacon/expo-router-top-tabs |
Beta Was this translation helpful? Give feedback.
-
Hi everyone. I've created a blog on how you can use Material Top Tabs in expo-router |
Beta Was this translation helpful? Give feedback.
-
I've been looking up a way to place the tabs in the main layout file and i found it, if anybody knows a better way, let me know. import { Stack } from "expo-router"
function RootLayout() {
return (
<Stack>
<Stack.Screen redirect name="index"/>
<Stack.Screen name="(tabs)"/>
</Stack>
)
}
export default RootLayout |
Beta Was this translation helpful? Give feedback.
-
Hi Everyone👋👋, If anyone want to use material top tabs in javascript, here's the code, I don't if this will work. btw, I converted it from typescript to jsdoc using /** @typedef {import('@react-navigation/native').ParamListBase} ParamListBase */
/** @typedef {import('@react-navigation/native').TabNavigationState} TabNavigationState */
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
import { withLayoutContext } from 'expo-router';
const { Navigator } = createMaterialTopTabNavigator();
export const MaterialTopTabs = withLayoutContext(Navigator); |
Beta Was this translation helpful? Give feedback.
-
How to set up Top tabs with expo-router? A code snippet or docs will be helpful.
A way without using react-navigation directly would be great.
Beta Was this translation helpful? Give feedback.
All reactions