-
Notifications
You must be signed in to change notification settings - Fork 187
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
Fix ensure array children #74
Conversation
The Expo app for the example from this branch is ready! expo.io/@pedrobern/react-native-collapsible-tab-view-demos?release-channel=pr-74 |
I'm liking this. However, this is still saying that there has to be more than one element in children? Another example where there might only be one child is. potentially, is if someone wanted to use this package to render a header with the snap, or diffClamp but without a TabBar - perhaps a Searchbox ontop of results? If we allow one child, then they can re-use the same page structure in the app as a page with more than one tab? I personally have a use-case in my app (which I know is unusual) where there are multiple user types but the most basic only has one tab as they don't have enough content. However, because of the way the profile page is structured (like Instagram), the user's profile image and details are rendered above the tabs? |
No, it accepts 1 or more 👍 if (React.Children.count(children) === 0) {
throw new Error('CollapsibleTabs must have at least one child.')
} The problem would be with 0 children, but that's not the use case you are saying |
Have you run the Default example and commented out the everything apart from Articles? (Or just leave any other one).
… On 30 Jan 2021, at 20:45, pedrobern ***@***.***> wrote:
I'm liking this. However, this is still saying that there has to be more than one element in children?
No, it accepts 1 or more 👍
if (React.Children.count(children) === 0) {
throw new Error('CollapsibleTabs must have at least one child.')
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
yes you are right, it throws an error with only 1 child! I will investigate now |
d7fba55
to
01419a1
Compare
@alexpchin now it's working the problem was with the indicator component. Works with 1 child, but I would recommend using "scrollable tabs" otherwise it will be one big tab. |
I've just pulled the latest version. However, I currrently see: With the type error being:
And: Is it working for you? |
I was having this error before, maybe you are not with the latest version, I rebased and forced push |
01419a1
to
95be6c2
Compare
@alexpchin just rebased and forced push again with the typescript fixes, can you test it? |
I merged, if you see any errors, let me know |
an alternative to #69
@alexpchin what you think?
Close #72
Close #68
documentation