Personalize your Native Base tab design

Recently, I've delved into the world of React Native and now find myself in need of assistance with customizing my tabs. Utilizing advanced tabs by Native Base, I aim to transform this:

https://i.stack.imgur.com/xhNwP.png


Into something more akin to:

https://i.stack.imgur.com/hDwAM.png


While exploring the Native Base documentation for insight on styling the tabs, I am at a loss as to where these properties ought to be placed:


Here's a snippet of my code:

<Container>
                    <Header
                        style={styles.headerColor}
                        iosBarStyle='light-content'
                    >
                        <Left>
                            <Button transparent onPress={()=>this.openDrawer()}>
                                <Icon name='ios-menu' style={styles.icons}/>
                            </Button>
                            </Left>
                        <Body>
                            <Title style={styles.headerTitle}>INQUIRY LIST</Title>
                        </Body>
                        <Right>
                            <Button transparent>
                                <Icon name='ios-search' style={styles.icons}/>
                            </Button>
                        </Right>
                    </Header>
                    <Tabs activeTabStyle={{borderBottomColor: '#fff'}}>
                        <Tab heading={ <TabHeading><Text style={styles.tabsText}>ALL</Text></TabHeading>}>
                            {/* <Tab1 /> */}
                        </Tab>
                        <Tab heading={ <TabHeading><Text style={styles.tabsText}>NEW</Text></TabHeading>}>
                            {/* <Tab2 /> */}
                        </Tab>
                        <Tab heading={ <TabHeading><Text style={styles.tabsText}>RECEIVED</Text></TabHeading>}>
                            {/* <Tab3 /> */}
                        </Tab>
                        <Tab heading={ <TabHeading><Text style={styles.tabsText}>IN PROGRESS</Text></TabHeading>}>
                            {/* <Tab3 /> */}
                        </Tab>
                        <Tab heading={ <TabHeading><Text style={styles.tabsText}>COMPLETED</Text></TabHeading>}>
                            {/* <Tab3 /> */}
                        </Tab>
                    </Tabs>
                    <Text>Hi from Inquiries</Text>
                </Container>
const styles = StyleSheet.create({
    tabsText:{
      fontSize: 10
    },
    headerColor:{
      backgroundColor: '#1b1b1b'
    },
    activeTab:{
      borderBottomColor: '#fff'
    }
  });

Answer №1

Here is an example of how I customized my tab design. Feel free to adjust the styling as necessary.

<Tabs tabBarUnderlineStyle={{ backgroundColor: '#f9ec97' }}>
                    <Tab heading="Description" activeTextStyle={{ color: '#fff', fontWeight: 'bold' }} textStyle={{ color: '#fff', fontSize: 12 }} tabStyle={{ backgroundColor: '#2f2483' }} activeTabStyle={{ backgroundColor: '#2f2483' }} >
                        {/* <Tab1 /> */}
                    </Tab>
.....
                </Tabs>

Remember to specify styles for each individual tab.

Answer №2

When setting up your Tabs, make sure to exclude <ScrollableTab /> and create a customized version instead

  <Tabs
    onChangeTab
    ref={(ref) => this.tabref = ref}
    renderTabBar={() => (
      <View style={{
        backgroundColor:"yellow",
        flexDirection:"row",
        justifyContent:"center"
      }}>
        <TouchableOpacity
          activeOpacity={1}
          onPress={() => this.tabref.goToPage(0)}
          activeTabStyle={{backgroundColor:"yellow"}}
          style={{
            backgroundColor:"red",
            width:width * 0.50,
            height:50,
            justifyContent:"center",
            alignItems:"center"
          }}>
          <Text>Sign In</Text>
        </TouchableOpacity>
        <TouchableOpacity
          activeOpacity={1}
          onPress={() => this.tabref.goToPage(1)}
          style={{
            backgroundColor:"green",
            width:width * 0.50,
            height:50,
            justifyContent:"center",
            alignItems:"center"
          }}>
          <Text>Sign Up</Text>
        </TouchableOpacity>
      </View>
    }
  >

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Integrating Javascript and JQuery in Reactjs: A Comprehensive Guide

Currently, I am working with ReactJS and utilizing the Next.js framework. My goal is to implement the provided code snippet in index.js to display data (day, month, etc.). How should I go about achieving this? Here is the code snippet: <script> fun ...

Unforeseen execution issues arising from repeated Ajax calls with SetTimeout in JavaScript

I have a list of users displayed in an HTML table that is dynamically created on page load. Each row includes an inline button with onclick="functionName(userId)" that triggers the following actions: When clicked, a Bootstrap modal popup is shown and the ...

When arriving on a page via an HTML anchor tag, the CSS style does not appear. How can I "reinstate" it?

I have set up a website with an index.html page that links to a contact.html page using anchor tags. On the contact.html page, there are anchor tags that should navigate the user back to specific sections of the index.html page. The navigation works fine, ...

The internet browser encountered a JavaScript runtime error (0x800a138f) in which it was unable to retrieve property '0' due to it being either undefined or pointing to a

I'm encountering an issue with my javascript/jquery function that retrieves the selected dropdown value. Everything works fine in Chrome, but when I try to run my application in IE, it throws an error. $("#Application_AppCountries").change(function ( ...

Angular's implementation of a web socket connection

I am facing an issue with my Angular project where the web socket connection only opens upon page reload, and not when initially accessed. My goal is to have the socket start as soon as a user logs in, and close when they log out. Here is the custom socke ...

Ways to incorporate a smooth transition between the opened and closed fab functionality

I am currently utilizing VueJS and Vuetify in my project. I have successfully implemented Vuetify's FAB component, which displays a list of fab buttons as demonstrated in the documentation: <div id="fab-button"> <v-speed-dial v-mo ...

Utilizing CSS3 Animation for enhanced hover effects

I have a setup with two divs. One of the divs expands in height when I hover over it. What I'm trying to achieve is to display text with a fade-in effect somewhere on the screen when I hover over that specific div. Additionally, I want to show another ...

Thymeleaf is responsible for fetching the static resources by referencing the REST URI

I am currently utilizing thymeleaf as my chosen template engine for a spring boot project. Here is the directory structure: src/main/ |- java | - UserAdministrationController.java |- resources | - static | - admin | - css ...

The division is now appearing below the preceding division instead of following it

I am currently encountering an issue that I believe has a simple solution, but I am unable to find it. I have two divs in my code. The first div contains a blurred background image and content, which is working perfectly fine. However, the second div is n ...

"Troubleshooting the slow loading of PDF files when using React's render-pdf feature

After creating a table with the ability for each row to generate and download a PDF using render-pdf npm, I encountered an issue. When the user clicks the download button, the PDF preview opens on a new page. However, there are problems with rendering as a ...

Utilizing Office.js: Incorporating Angular CLI to Call a Function in a Generated Function-File

After using angular-cli to create a new project, I integrated ng-office-ui-fabric and its dependencies. I included in index.html, added polyfills to angular.json, and everything seemed to be working smoothly. When testing the add-in in Word, the taskpane ...

The ng-app feature is causing the script to run endlessly

Currently, I am troubleshooting an issue within my angular application that is built on the asp.net web application empty template. The problem arises when I utilize ng-app; if I leave it blank, the $routeProvider fails to initialize. However, if I specify ...

What is the process for embedding a NextJS app within a different website?

I'm searching for alternative methods to embed a React/NextJS application within another application. Currently, my solution involves using an iframe and specifying the source as the execution of the React/Nextjs application. I've explored diff ...

What is the process for inspecting the element within a div using jsname with JS?

Struggling to inspect elements within a DIV without using xpath. // Assert.assertEquals("Digite uma senha",driver.findElement(By.xpath("//*[@id=\"view_container\"]/div/div/div[2]/div/div[1]/div/form/span/section/div/div/div[1]/div[2]/div[2] ...

Retrieve a div element using Ajax from the result of an If statement

I need to extract a specific div from the data returned by an if statement that is formatted as HTML, and then display it within another div. I have been attempting to achieve this using the code below, but so far it has not been successful... Here is my ...

The sonar scanner encountered an error while attempting to parse a file using the espree parser in module mode

While executing sonar-scanner on a node project, I encounter a Failed to parse file issue, as shown below: ERROR: Failed to parse file [file:///home/node-app/somedir/index.js] at line 1: Unexpected token './AddCat' (with espree parser in mod ...

I am currently exploring next.js and working on creating a dedicated single post page within my project

I am currently working with Next.js and fetching some dummy data on the homepage. However, I am facing an issue when trying to create a separate page for each post obtained from the homepage. Although I have already coded it, I feel like there is room fo ...

Send information as FormData object

I'm getting the data in this format: pert_submit: {systemId: "53183", pert-id: "176061", score: 0, q2c: "3\0", q2t: "", …} Now I need to send it as FormData in my post request. Since I can't use an ...

Solving the style upload issue with NextJS and Module Federation in ReactJS

My current project utilizes React 18 and webpack 5 with the module federation plugin. I am exploring the possibility of integrating Next JS with module federation, but I am encountering an issue where the host project is not able to fetch styles from the r ...

Storing account information in a .env file can be a more secure option compared to storing it in a client

Working on a basic nodejs application using express for file processing operations. Planning to package the final app with pkg. I need to implement a login system and one time account creation. The app will launch a browser tab running a vuejs UI app. Cons ...