JSPM

@react-navigation/material-top-tabs

5.0.0-alpha.24
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 220203
  • Score
    100M100P100Q185964F
  • License MIT

Integration for the animated tab view component from react-native-tab-view

Package Exports

  • @react-navigation/material-top-tabs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@react-navigation/material-top-tabs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@react-navigation/material-top-tabs

React Navigation integration for animated tab view component from react-native-tab-view.

Installation

Open a Terminal in your project's folder and run,

yarn add @react-navigation/native @react-navigation/material-top-tabs react-native-tab-view

Now we need to install react-native-gesture-handler and react-native-reanimated..

If you are using Expo, to ensure that you get the compatible versions of the libraries, run:

expo install react-native-gesture-handler react-native-reanimated

If you are not using Expo, run the following:

yarn add react-native-reanimated react-native-gesture-handler

If you are using Expo, you are done. Otherwise, continue to the next steps.

To complete the linking on iOS, make sure you have Cocoapods installed. Then run:

cd ios
pod install
cd ..

IMPORTANT: There are additional steps required for react-native-gesture-handler on Android after linking (for all React Native versions). Check the this guide to complete the installation.

Usage

import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';

const MaterialTopTabs = createMaterialTopTabNavigator();

export default function App() {
  return (
    <MaterialTopTabs.Navigator>
      <MaterialTopTabs.Screen
        name="article"
        component={Article}
        options={{ tabBarLabel: 'Article' }}
      />
      <MaterialTopTabs.Screen
        name="chat"
        component={Chat}
        options={{ tabBarLabel: 'Chat' }}
      />
      <MaterialTopTabs.Screen
        name="contacts"
        component={Contacts}
        options={{ tabBarLabel: 'Contacts' }}
      />
    </MaterialTopTabs.Navigator>
  );
}