Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dcs-rn-ui

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dcs-rn-ui

React Native UI elements

  • 1.0.1-rc.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

This component uses react-navigation module, more precisely the TabNavigator, which creates tabs that can be included into any container.
To use it, you need to inject the navigator like it is described next:

<ThemeProvider>
  <AppNavigator />
</ThemeProvider>

Then in your `.js` navigator file, which in this case its called AppNavigator, you need to define the required parameters that will be passed into the `Tabs` component, which is just the routeConfig property described on the following example:

const tabsSetupConfig = {
  routeConfig: {
    ScreenOne: {
      screen: ScreenOne,
      path: '/screenone',
      navigationOptions: {
        title: 'Title of the Screen One',
      },
    },
    ScreenTwo: {
      screen: ScreenTwo,
      path: '/screentwo',
      navigationOptions: {
        title: 'Title of the Screen Two',
      },
    },
  },
  navigatorConfig: {}
}

export default Tabs(tabsSetupConfig)

If you want to overide the default tabs layout, just include into navigatorConfig the properties defined next, which are the ones set by default on the Tabs.js component:

{
  tabBarPosition: '<position>' // Will choose position based on operating system (ios: bottom, android: top),
  tabBarComponent: <component> // Primary by default,
  swipeEnabled: true,
  animationEnabled: true,
  tabBarOptions: {
    activeTintColor: 'rgba(255, 255, 255, 1)',
    inactiveTintColor: 'rgba(255, 255, 255, 1)',
    style: {
      backgroundColor: '#000000',
    },
    // Note that setting 'tabStyle' property, disables the ability to style 'indicatorStyle'
    indicatorStyle: {
      backgroundColor: '#FF0000',
    },
  },
}

Supported Tabs Components:

  • Primary (default)

How to use:

import { Navigation } from 'dcs-rn-ui'

const tabsSetupConfig = {
  routeConfig: {
    FirstScreen: {
      screen: () => null,
      navigationOptions: ({ screenProps }) => {
        const { tabBarIcon, tabBarLabel } = Navigation.Tabs.Item({
          label: 'text',
          icon: 'icon-name',
        })

        return { tabBarIcon, tabBarLabel }
      },
    },
    AuthPin: {
      screen: () => null,
      navigationOptions: ({ screenProps }) => {
        const { tabBarIcon, tabBarLabel } = Navigation.Tabs.Item({
          label: 'text',
          icon: 'icon-name',
        })

        return { tabBarIcon, tabBarLabel }
      },
    },
  },
  navigatorConfig: {
    initialRouteName: 'FirstScreen',
    tabBarComponent: Navigation.Tabs.Primary ( by default it uses the primary, so this is optional)
  },
}

If for some reason the default properties of the Tabs component need to be changed, modify the variable named defaultNavigatorConfig located in the Tabs.js file.

FAQs

Package last updated on 05 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc