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

Navigation tabs inside CollapsibleHeaderLayout are not supported #288

Closed
swati-eaton opened this issue Aug 4, 2022 · 5 comments · Fixed by #299
Closed

Navigation tabs inside CollapsibleHeaderLayout are not supported #288

swati-eaton opened this issue Aug 4, 2022 · 5 comments · Fixed by #299
Assignees
Labels
brightlayer-ui Used to identify Brightlayer UI platform issues for easy filtering enhancement Request for improvement or new feature external-dependency Depends on an upstream package or library user-reported This was reported by a user outside the maintainers team. wont-fix Can't or won't be fixed by the dev team

Comments

@swati-eaton
Copy link

swati-eaton commented Aug 4, 2022

We need to add Tab.Navigator inside CollapsibleHeaderLayout

Component : https://brightlayer-ui-components.github.io/react-native/?path=/info/components-documentation--collapsible-header-layout

When we try to do same, corresponding tabs screens are not getting rendered and swipe functionality is also not working.

<CollapsibleHeaderLayout
                HeaderProps={{
                    variant: 'dynamic',
                    title: 'School of fine arts',
                    subtitle: 'Org name',
                    info: 'location',
                    icon: { name: 'arrow-back' },
                    onIconPress: () => {
                        navigation.pop();
                    },
                    actionItems: [{ icon: { name: 'edit' }, onPress: () => {} }],
                    collapsedHeight: 50,
                    expandedHeight: 200,
                    expandable: true,
                }}
                               
                <Tab.Navigator
                    screenOptions={{
                        swipeEnabled: true,
                    }}
                >
                    <Tab.Screen name="Help" component={Help} />
                    <Tab.Screen name="AccountSettings" component={AccountSettings} />
                </Tab.Navigator>
            >
</CollapsibleHeaderLayout>

UX_Design

@swati-eaton swati-eaton added enhancement Request for improvement or new feature needs-review Issues that we would like to revisit/review labels Aug 4, 2022
@ektasawant ektasawant added user-reported This was reported by a user outside the maintainers team. and removed needs-review Issues that we would like to revisit/review labels Aug 17, 2022
@daileytj
Copy link
Contributor

From Swati Jain:

"I have tried by keeping tab navigator outside of the CollapsibleHeader component and with this we are able to render the tabs perfectly But header is not scrollable with this approach as it will not have much content to get scroll area.

As per current UX design, it’s expected to scroll (expand/collapse) header and to achieve this all the bottom content we should keep it inside CollapsibleHeader. "

@daileytj
Copy link
Contributor

See if we can put together a code snippet for this.

@swati-eaton
Copy link
Author

Hi @daileytj Did you get a chance to look into this ?

@bkarambe
Copy link
Contributor

<CollapsibleHeaderLayout
HeaderProps={{
variant: 'dynamic',
title: 'School of fine arts',
subtitle: 'Org name',
info: 'location',
icon: { name: 'arrow-back' },
onIconPress: () => {
navigation.pop();
},
actionItems: [{ icon: { name: 'edit' }, onPress: () => {} }],
collapsedHeight: 50,
expandedHeight: 200,
expandable: true,
}}

            <Tab.Navigator
                screenOptions={{
                    swipeEnabled: true,
                }}
            >
                <Tab.Screen name="Help" component={Help} />
                <Tab.Screen name="AccountSettings" component={AccountSettings} />
            </Tab.Navigator>
        >

Hi @daileytj Did you get a chance to look into this ?

Hi @swati-eaton We are currently looking at this issue. We will update you soon.

@bkarambe bkarambe added the external-dependency Depends on an upstream package or library label Nov 30, 2022
@bkarambe
Copy link
Contributor

bkarambe commented Nov 30, 2022

Hi @swati-eaton ,
You correctly identified the header did not support custom children e.g. tabs. We are fixing this and we have a PR for that enhancement. That update should get published this week. This will allow you to put things like tabs into the Header itself so it won't scroll behind the header.

However, the main issue you are seeing is caused by react-navigation/material-top-tabs which uses react-native-tab-view.

This view does not work when it is placed inside of a Scrollview (like the body of the CollapsibleHeaderLayout) or some other containers — refer to react-navigation/react-navigation#10361. And when putting it in the Header, it tries to render both the tabs and the pages in the Header, which is not desirable.

You'll probably need to tackle this from a more custom approach in order to separate the Tabs from the content (as you are trying to do in your design). You may be able to do this by treating the tabs as separate routes in a Stack Navigator, or manually implementing the paging with something like react-native-pager-view within the CollapsibleHeaderLayout body.

@bkarambe bkarambe added the wont-fix Can't or won't be fixed by the dev team label Nov 30, 2022
@joebochill joebochill added the brightlayer-ui Used to identify Brightlayer UI platform issues for easy filtering label Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
brightlayer-ui Used to identify Brightlayer UI platform issues for easy filtering enhancement Request for improvement or new feature external-dependency Depends on an upstream package or library user-reported This was reported by a user outside the maintainers team. wont-fix Can't or won't be fixed by the dev team
Development

Successfully merging a pull request may close this issue.

5 participants