question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrapping Tab into React.FC prevents tab switching

See original GitHub issue

I might be doing it wrong but I tried to wrap Tab into another component as

import {Tab as BaseUITab, TabProps } from 'baseui/tabs';

const Tab: React.FC<TabProps> = ({ children }, props) => (
  <BaseUITab overrides={{ Tab: { style: { flex: 1 } } }} {...props}>
    {children}
  </BaseUITab>
);

However, when this is used within <StatefulTabs> tab switching stops working.

Example https://codesandbox.io/s/uncontrolled-tabs-usage-3e5y2 There are two usage types, first is my wrap attempt, second is typical documented approach to show it works just fine that way.

Tech Version
Base UI v9.4.2
  • I have searched the issues of this repository and believe that this is not a duplicate.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
simPodcommented, Jul 27, 2020

I have created more relevant followup here https://github.com/uber/baseweb/issues/3548

0reactions
simPodcommented, Jul 27, 2020

@chasestarr I’d still love to do it. <Tab {...commonTabProps} is only a workaround and is kind of repetitive, also it’s easy to forget to include default tab props.

See https://codesandbox.io/s/baseweb-nklju?file=/src/example.tsx

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wrapping Tab into React.FC prevents tab switching #1948
I might be doing it wrong but I tried to wrap Tab into another component as import {Tab as BaseUITab, TabProps } from...
Read more >
How can I stop text wrap in Tab.Screen react native
You can try changing some of the style props of the navigator and experimenting with the width. For example: <Tab.
Read more >
How to Use Wrappers in Typescript React - Twilio
Learn about the importance of wrappers and practice using wrappers for a custom component in a Typescript React project.
Read more >
React conditional rendering: 9 methods with examples
In React, you use curly braces to wrap an IIFE, put all the logic you want inside it, like an if...else , switch...
Read more >
Optimizing React performance by preventing unnecessary re ...
Re-rendering React components unnecessarily can slow down your app and make the UI feel unresponsive. This article explains how to update ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found