React native collapsible tabview example
This is just a simple example implementing a tabview with collapsible header. Here we use react-native-tab-view in our implemetation.
Dependencies
2022-07
- Here I've upgraded
react-native
to0.68.2
,andreact-native-tab-view
to3.1.1
. react-native-reanimated
andreact-native-gesture-handler
have been removed byreact-native-tab-view
.hermes
is default enabled on bothiOS
andAndroid
.- No changes to example code.
- No furthur updates for old version.
2021-06
- Be noticed that we are using react-native
0.62.2
in this example, some breaking changes may lead to crashes. - Accroding to this post,
getNode()
is deprecated. As a result, before0.62.0
you should useref.getNode()
in order to get correctref
for theAnimated
component.
Usage
There are three examples under src
folder:
CollapsibleTabView
: provides the most basic workable example without scrollable header and pull-to-refresh.HeaderScrollableTabView
: provides scrollable header without pull-to-refresh.PullRefreshTabView
: provides both scrollable header and pull-to-refresh.
It is critical to give the correct paddingTop
and minHeight
of contentContainerStyle
of the FlatList
contentContainerStyle={{
...
paddingTop: HeaderHeight + TabBarHeight,
minHeight: windowHeight - SafeStatusBar + HeaderHeight,
}}