Gathering detailed insights and metrics for react-navigation-collapsible
Gathering detailed insights and metrics for react-navigation-collapsible
Gathering detailed insights and metrics for react-navigation-collapsible
Gathering detailed insights and metrics for react-navigation-collapsible
npm install react-navigation-collapsible
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,164 Stars
268 Commits
93 Forks
13 Watching
6 Branches
16 Contributors
Updated on 23 Oct 2024
TypeScript (65.48%)
Java (14.45%)
Objective-C (10.47%)
JavaScript (4.35%)
Makefile (1.92%)
Ruby (1.7%)
Starlark (1.4%)
Shell (0.23%)
Cumulative downloads
Total Downloads
Last day
80.6%
233
Compared to previous day
Last week
22.7%
950
Compared to previous week
Last month
-10.4%
4,376
Compared to previous month
Last year
-32.7%
52,486
Compared to previous year
2
4
An extension of react-navigation that makes your header collapsible.
Try out the demo on Expo Snack
🏗 The Collapsible Tab-navigator is no longer supported due to the Android bug from react-native.
1// Expo ONLY 2import { disableExpoTranslucentStatusBar } from 'react-navigation-collapsible'; 3 4/* Call this If you have disabled Expo's default translucent statusBar. */ 5disableExpoTranslucentStatusBar();
1import { Animated } from 'react-native'; 2import { useCollapsibleHeader } from 'react-navigation-collapsible'; 3 4const MyScreen = ({ navigation, route }) => { 5 const options = { 6 navigationOptions: { 7 headerStyle: { backgroundColor: 'green', height: 150 } /* Optional */, 8 headerBackground: <Image /> /* Optional */, 9 }, 10 config: { 11 collapsedColor: 'red' /* Optional */, 12 useNativeDriver: true /* Optional, default: true */, 13 elevation: 4 /* Optional */, 14 disableOpacity: true /* Optional, default: false */, 15 }, 16 }; 17 const { 18 onScroll /* Event handler */, 19 onScrollWithListener /* Event handler creator */, 20 containerPaddingTop /* number */, 21 scrollIndicatorInsetTop /* number */, 22 /* Animated.AnimatedValue contentOffset from scrolling */ 23 positionY /* 0.0 ~ length of scrollable component (contentOffset) 24 /* Animated.AnimatedInterpolation by scrolling */, 25 translateY /* 0.0 ~ -headerHeight */, 26 progress /* 0.0 ~ 1.0 */, 27 opacity /* 1.0 ~ 0.0 */, 28 } = useCollapsibleHeader(options); 29 30 /* in case you want to use your listener 31 const listener = ({nativeEvent}) => { 32 // I want to do something 33 }; 34 const onScroll = onScrollWithListener(listener); 35 */ 36 37 return ( 38 <Animated.FlatList 39 onScroll={onScroll} 40 contentContainerStyle={{ paddingTop: containerPaddingTop }} 41 scrollIndicatorInsets={{ top: scrollIndicatorInsetTop }} 42 /* rest of your stuff */ 43 /> 44 ); 45};
See /example/src/DefaultHeaderScreen.tsx
See /example/src/StickyHeaderScreen.tsx
See /example/src/BackgroundHeaderScreen.tsx
1import { Animated } from 'react-native'; 2import { 3 useCollapsibleSubHeader, 4 CollapsibleSubHeaderAnimator, 5} from 'react-navigation-collapsible'; 6 7const MySearchBar = () => ( 8 <View style={{ padding: 15, width: '100%', height: 60 }}> 9 <TextInput placeholder="search here" /> 10 </View> 11); 12 13const MyScreen = ({ navigation, route }) => { 14 const { 15 onScroll /* Event handler */, 16 containerPaddingTop /* number */, 17 scrollIndicatorInsetTop /* number */, 18 translateY, 19 } = useCollapsibleSubHeader(); 20 21 return ( 22 <> 23 <Animated.FlatList 24 onScroll={onScroll} 25 contentContainerStyle={{ paddingTop: containerPaddingTop }} 26 scrollIndicatorInsets={{ top: scrollIndicatorInsetTop }} 27 /* rest of your stuff */ 28 /> 29 {/* Wrap your component with `CollapsibleSubHeaderAnimator` */} 30 <CollapsibleSubHeaderAnimator translateY={translateY}> 31 <MySearchBar /> 32 </CollapsibleSubHeaderAnimator> 33 </> 34 ); 35};
See /example/src/SubHeaderScreen.tsx
1import { Animated } from 'react-native'; 2import { useCollapsibleHeader } from 'react-navigation-collapsible'; 3 4const MyScreen = ({ navigation, route }) => { 5 const options = { 6 navigationOptions: { 7 /* Add a custom header to 'useCollapsibleHeader' options the same way you would add it to the Stack.Screen options */ 8 header: ({ scene, previous, navigation }) => { 9 const { options } = scene.descriptor; 10 const title = 11 options.headerTitle !== undefined 12 ? options.headerTitle 13 : options.title !== undefined 14 ? options.title 15 : scene.route.name; 16 17 return ( 18 <MyHeader 19 title={title} 20 leftButton={ 21 previous ? ( 22 <MyBackButton onPress={navigation.goBack} /> 23 ) : ( 24 undefined 25 ) 26 } 27 style={options.headerStyle} 28 /> 29 ); 30 }, 31 }, 32 }; 33 const { 34 onScroll /* Event handler */, 35 containerPaddingTop /* number */, 36 scrollIndicatorInsetTop /* number */, 37 } = useCollapsibleHeader(options); 38 39 return ( 40 <Animated.FlatList 41 onScroll={onScroll} 42 contentContainerStyle={{ paddingTop: containerPaddingTop }} 43 scrollIndicatorInsets={{ top: scrollIndicatorInsetTop }} 44 /* rest of your stuff */ 45 /> 46 ); 47};
See /example/src/CustomHeaderScreen.tsx
react-navigation
recommends to use headerMode='screen'
when you use the custom header. [Set headerMode
to screen
]
1# install module 2yarn add react-navigation-collapsible
PR is welcome!
/example imports the library directly from the root folder, configured with babel-plugin-module-resolver.
So, just build the library with the watch
option and run the example.
1yarn tsc -w 2cd example && yarn ios
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 4/29 approved changesets -- score normalized to 1
Reason
project is archived
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
41 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More