PedroBern / react-native-collapsible-tab-view

A cross-platform Collapsible Tab View component for React Native
MIT License
868 stars 171 forks source link

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

Open kurucaner opened 3 months ago

kurucaner commented 3 months ago

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

Current behavior

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

lorenzogonnelli commented 3 weeks ago

same problem here :(