Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to override bottom tab sideContent and bottomContent styles #11927

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

evoactivity
Copy link

@evoactivity evoactivity commented Apr 5, 2024

Motivation

This is an extension to #11578

I'm using the alphas in a new project to create sidebar tabs but I am running into problems related to how the sideContent and bottomContent styles are being applied

  1. Default padding of sidebar cannot be overriden as it's set as a constant


    sideContent: {
    flex: 1,
    flexDirection: 'column',
    padding: SPACING,
    },

    <View
    accessibilityRole="tablist"
    style={tabBarIsHorizontal ? styles.bottomContent : styles.sideContent}
    >

  2. Cannot make tabs be centred through justifyContent. There is not way to supply additional styles that merge with sideContent or bottomContent.

Both issues could be addressed by merging in another style option eg

<View
  accessibilityRole="tablist"
  style={[
    tabBarIsHorizontal ? 
      styles.bottomContent 
      : styles.sideContent, 
    tabBarContentStyle
  ]}
>

Which is what this PR does

Test plan

Create sidebar tabs with these options

const screenOptions: BottomTabNavigationOptions = {
  headerShown: false,
  tabBarPosition: 'left',
  tabBarShowLabel: false,
  tabBarIconStyle: {
    width: 20,
    height: 20,
  },
  tabBarStyle: {
    backgroundColor: '#18082c',
    borderEndWidth: 0,
    minWidth: 0,
    padding: 0,
    paddingStart: 0,
    paddingEnd: 0,
    paddingTop: 0,
    paddingBottom: 0,
  },
  tabBarItemStyle: {
    marginHorizontal: 0,
    marginVertical: 0,
    borderRadius: 0,
    padding: 18,
  },
};

Tabs will be aligned at the top, add this option to center them and remove default padding

tabBarContentStyle: {
  padding: 0,
  justifyContent: 'center',
},

You should see this change from this
image

to

image

Copy link

github-actions bot commented Apr 5, 2024

Hey @evoactivity! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines.

Copy link

github-actions bot commented Apr 5, 2024

Hey @autofix-ci[bot]! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines.

Copy link

netlify bot commented Apr 5, 2024

Deploy Preview for react-navigation-example ready!

Name Link
🔨 Latest commit d319c32
🔍 Latest deploy log https://app.netlify.com/sites/react-navigation-example/deploys/661022ffc1641c0007e07d03
😎 Deploy Preview https://deploy-preview-11927--react-navigation-example.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Apr 5, 2024

Deploy Preview for react-navigation-example ready!

Name Link
🔨 Latest commit 034749c
🔍 Latest deploy log https://app.netlify.com/sites/react-navigation-example/deploys/66155bebf1125b0008d39cc5
😎 Deploy Preview https://deploy-preview-11927--react-navigation-example.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@evoactivity evoactivity force-pushed the ability-to-override-sideContent-styles branch from 5b1f8ec to bddbdb0 Compare April 5, 2024 16:17
@evoactivity evoactivity changed the title feat: add ability to override bottom tab sideContent styles feat: add ability to override bottom tab sideContent and bottomContent styles Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant