Skip to main content
Version: Next

Pagerview

The PagerView component is that is designed to create a tab-based view with a sliding indicator on top of it. It uses the "react-native-pager-view" library to handle animations.

Import

import { PagerView } from '@tra-tech/react-native-kitra';

Usage

import { PagerView } from '@tra-tech/react-native-kitra';

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

const App = () => (
<View style={{ flex: 1 }}>
<PagerView containerStyle={{ marginTop: 10 }} >
<View key="React" style={style.itemContainer}>
<Text>Pager</Text>
</View>
<View key="Native" style={style.itemContainer}>
<Text>View</Text>
</View>
<View key="Kitra" style={style.itemContainer}>
<Text>Component</Text>
</View>
</PagerView>
</View>
);

const style = StyleSheet.create({
itemContainer: { flex: 1, alignItems: 'center', justifyContent: 'center' },
});

export default App;

Props

Prop nameTypeRequiredDescription
childrenReact.ReactNodeYesA required prop that represents the content to display within the PagerView component.
containerStyleStyleProp<ViewStyle>NoAdditional styles to apply to the pager view container.
pageContainerStyleStyleProp<ViewStyle>NoAdditional styles to apply to the page container.
headerSliderStyleStyleProp<ViewStyle>NoStyle of header slider.
headerContainerStyleStyleProp<ViewStyle>NoStyle of header slider container.
headerLabelStyleStyleProp<TextStyle>NoText style of header text.
injectPagerRefbooleanNoAn optional boolean prop that determines whether to inject the PagerView reference into each child component's props. Default value: false
showDividerbooleanNoDetermines whether the divider is shown or not. Default value:true
dividerStyleStyleProp<ViewStyle>NoStyle of divider
dividerColorstringNoColor of divider
iconsReact.ReactElement<typeof Icon> []NoIcon list for header texts.
themeUITheme NoThe theme to use for the component.
typographyUITypographyNoThe typography to use for the component.