react-native-collapsible-tab-view icon indicating copy to clipboard operation
react-native-collapsible-tab-view copied to clipboard

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

Open kurucaner opened this issue 8 months ago • 1 comments

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 avatar Jun 17 '24 19:06 kurucaner