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

Container children must be wrapped in a <Tabs.Tab ... /> component #422

Open
kurucaner opened this issue Jun 17, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@kurucaner
Copy link

kurucaner commented Jun 17, 2024

I'm encountering an issue when trying to create a reusable component that contains Tabs.Tab as a wrapper and displays all the children. The Tabs.Container component is expecting its children to be directly wrapped in Tabs.Tab components, but this requirement seems to cause an error when using a reusable component.

export const ReviewsTab = ({ children }) => {
  return (
    <Tabs.Tab name="Reviews" label="Reviews">
      {children}
    </Tabs.Tab>
  );
};

const Foo = () => {
  <Tabs.Container>
    <ReviewsTab>
      <Text>Foo</Text>
    </ReviewsTab>
  </Tabs.Container>
};

Feature request

  • Create a reusable component that contains Tabs.Tab as a wrapper and renders all the children.
  • Use this reusable component in a parent component where Tabs.Container is used.

Current behavior

It throws an error: "Container children must be wrapped in a <Tabs.Tab ... /> component"

@kurucaner kurucaner added the enhancement New feature or request label Jun 17, 2024
@lorenzogonnelli
Copy link

same problem here :(

@mhmdiqbal
Copy link

You can create a reusable component like this:

<Tabs.Tab label={t`Collections`} name="collections">
  <TabCollections />
</Tabs.Tab>

const TabCollections = () => {
  return (
    <Tabs.FlatList />
  );
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants