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

Added collapsable header #987

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Added collapsable header #987

wants to merge 6 commits into from

Conversation

hrkw00
Copy link

@hrkw00 hrkw00 commented Feb 23, 2019

Added collapsable header which is able to put on the tabbar.

@shuiRong
Copy link

shuiRong commented Feb 24, 2019

@hrkw00
Do you have an example?
( Here's my code, but the FlatList doesn't show. )

@hrkw00
Copy link
Author

hrkw00 commented Feb 25, 2019

@shuiRong
Hello, thank you for sending a message to me.
Here is an example code for using collapsable bar

import { StyleSheet, View, Text, SafeAreaView } from 'react-native'

import ScrollableTabView from 'react-native-scrollable-tab-view'
import TabBar from 'react-native-underline-tabbar'

import LabelView from '../components/label-view'
import MockFlatList from '../components/mock-flatlist'
import MockColorfulList from '../components/mock-colorful-list'

interface State {
  readonly scrollEnabled: boolean
}

export default class ScrollableTabViewScreen extends React.Component<
  {},
  State
> {
  readonly state: State = {
    scrollEnabled: true,
  }
  render() {
    const header = (
      <View
        style={{
          alignSelf: 'stretch',
          height: 200,
          justifyContent: 'center',
          alignItems: 'center',
        }}
      >
        <Text>Header</Text>
      </View>
    )

    return (
      <SafeAreaView style={styles.container}>
        <ScrollableTabView
          collapsableBar={header}
          showsVerticalScrollIndicator={false}
          scrollEnabled={this.state.scrollEnabled}
          renderTabBar={() => (
            <TabBar
              tabBarStyle={{ marginTop: 0 }}
              scrollContainerStyle={{ backgroundColor: '#fff' }}
            />
          )}
        >
          <LabelView tabLabel={{ label: 'First Screen' }}>
            <MockFlatList />
          </LabelView>
          <LabelView tabLabel={{ label: 'Second Screen' }}>
            <MockColorfulList />
          </LabelView>
          <LabelView tabLabel={{ label: 'Third Screen' }}>
            <MockFlatList />
          </LabelView>
          <LabelView tabLabel={{ label: 'Fourth Screen' }}>
            <MockColorfulList />
          </LabelView>
          <LabelView tabLabel={{ label: 'Fifth Screen' }}>
            <MockFlatList />
          </LabelView>
          <LabelView tabLabel={{ label: 'Sixth Screen' }}>
            <MockColorfulList />
          </LabelView>
        </ScrollableTabView>
      </SafeAreaView>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
  },
})

@LevisLuong
Copy link

Hi @hrkw00 , I got same issue with @shuiRong, It didn't show the content tab on Android.

@EliYenn
Copy link

EliYenn commented Jun 25, 2019

@hrkw00 How to pull you commit ? lastversion Does not contain,Please help,Thank!!

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

Successfully merging this pull request may close these issues.

None yet

4 participants