Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
@gorhom/bottom-sheet
Advanced tools
A performant interactive bottom sheet with fully configurable options π
@gorhom/bottom-sheet is a performant and customizable bottom sheet component for React Native. It allows developers to create modal-like bottom sheets that can be used for various purposes such as displaying additional content, forms, or actions. The package is highly flexible and supports gestures, animations, and various customization options.
Basic Bottom Sheet
This code demonstrates how to create a basic bottom sheet with three snap points (collapsed, half-expanded, and fully expanded). The bottom sheet can be opened by pressing a button.
```jsx
import React, { useRef } from 'react';
import { View, Text, Button } from 'react-native';
import BottomSheet from '@gorhom/bottom-sheet';
const App = () => {
const bottomSheetRef = useRef(null);
return (
<View style={{ flex: 1 }}>
<Button title="Open Bottom Sheet" onPress={() => bottomSheetRef.current?.expand()} />
<BottomSheet ref={bottomSheetRef} snapPoints={[0, '50%', '100%']}>
<View style={{ flex: 1, alignItems: 'center' }}>
<Text>Bottom Sheet Content</Text>
</View>
</BottomSheet>
</View>
);
};
export default App;
```
Custom Handle Component
This code demonstrates how to use a custom handle component for the bottom sheet. The custom handle can be styled and customized as needed.
```jsx
import React, { useRef } from 'react';
import { View, Text, Button } from 'react-native';
import BottomSheet, { BottomSheetHandle } from '@gorhom/bottom-sheet';
const CustomHandle = () => (
<View style={{ padding: 20, backgroundColor: 'lightgray' }}>
<Text>Custom Handle</Text>
</View>
);
const App = () => {
const bottomSheetRef = useRef(null);
return (
<View style={{ flex: 1 }}>
<Button title="Open Bottom Sheet" onPress={() => bottomSheetRef.current?.expand()} />
<BottomSheet ref={bottomSheetRef} snapPoints={[0, '50%', '100%']} handleComponent={CustomHandle}>
<View style={{ flex: 1, alignItems: 'center' }}>
<Text>Bottom Sheet Content</Text>
</View>
</BottomSheet>
</View>
);
};
export default App;
```
Bottom Sheet with FlatList
This code demonstrates how to use a FlatList inside the bottom sheet. This is useful for displaying a list of items within the bottom sheet.
```jsx
import React, { useRef } from 'react';
import { View, Text, Button, FlatList } from 'react-native';
import BottomSheet from '@gorhom/bottom-sheet';
const App = () => {
const bottomSheetRef = useRef(null);
const data = Array.from({ length: 50 }, (_, i) => `Item ${i + 1}`);
return (
<View style={{ flex: 1 }}>
<Button title="Open Bottom Sheet" onPress={() => bottomSheetRef.current?.expand()} />
<BottomSheet ref={bottomSheetRef} snapPoints={[0, '50%', '100%']}>
<FlatList
data={data}
keyExtractor={(item) => item}
renderItem={({ item }) => (
<View style={{ padding: 20 }}>
<Text>{item}</Text>
</View>
)}
/>
</BottomSheet>
</View>
);
};
export default App;
```
reanimated-bottom-sheet is another popular bottom sheet component for React Native. It is built on top of Reanimated and Gesture Handler libraries, providing smooth animations and gesture handling. Compared to @gorhom/bottom-sheet, it offers similar functionalities but may require more setup due to its dependencies on Reanimated and Gesture Handler.
react-native-modalize is a highly customizable modal component for React Native that can be used to create bottom sheets. It supports various features such as snapping points, custom handles, and more. While it offers similar functionalities to @gorhom/bottom-sheet, it is more focused on providing a general modal solution rather than just bottom sheets.
react-native-bottom-sheet-behavior is a library that provides bottom sheet behavior for React Native applications. It is inspired by the BottomSheetBehavior component in Android. This package is more Android-centric and may not offer the same level of customization and performance as @gorhom/bottom-sheet.
A performant interactive bottom sheet with fully configurable options π
FlatList
, SectionList
, ScrollView
& View
scrolling interactions.React Navigation
Integration.Reanimated
v1 & v2.Expo
.TypeScript
.Check out the documentation website.
This library been written in 2 versions of Reanimated
, and kept both implementation in 2 separate branches:
This version is written with Reanimated v1
& compatible with Reanimated v2
, this version is located at master
branch and its changelog here.
This version is written with Reanimated v2
and CAN NOT RUN with Reanimated v1
, this version is located at v3
branch and its changelog here.
All new features will be added to Reanimated v2
version, however I will keep maintaining Reanimated v1
version until further notice.
FAQs
A performant interactive bottom sheet with fully configurable options π
The npm package @gorhom/bottom-sheet receives a total of 356,389 weekly downloads. As such, @gorhom/bottom-sheet popularity was classified as popular.
We found that @gorhom/bottom-sheet demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonarβs acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.