Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@amir-hossein-karimi/bottom-sheet
Advanced tools
Small react native bottom sheet
npm install @amir-hossein-karimi/bottom-sheet
or
yarn add @amir-hossein-karimi/bottom-sheet
Opening and closing the bottom sheet is done imperatively, so just pass a ref
to the bottom sheet and call the open
or close
methods via the ref
instance to open and close the bottom sheet respectively.
import React, { useRef } from 'react';
import BottomSheet, { BottomSheetMethods } from '@amir-hossein-karimi/bottom-sheet';
import { Button, View } from 'react-native';
const App = () => {
const sheetRef = useRef<BottomSheetMethods>(null);
return (
<View>
<Button title="Open" onPress={() => sheetRef.current?.open()} />
<BottomSheet ref={sheetRef}>
<Text>
The smart 😎, tiny 📦, and flexible 🎗 bottom sheet your app craves 🚀
</Text>
</BottomSheet>
</View>
);
};
export default App;
import React, { useRef } from 'react';
import BottomSheet, { BottomSheetMethods } from '@amir-hossein-karimi/bottom-sheet';
import { Button, View } from 'react-native';
const App = () => {
const sheetRef = useRef(null);
return (
<View>
<Button title="Open" onPress={() => sheetRef.current?.open()} />
<BottomSheet ref={sheetRef}>
<Text>
The smart 😎, tiny 📦, and flexible 🎗 bottom sheet your app craves 🚀
</Text>
</BottomSheet>
</View>
);
};
The bottom sheet component uses and handles pan gestures internally, so to avoid scroll/pan misbehavior with its container, DO NOT put it inside a container that supports panning e.g ScrollView
. You can always put it just next to the ScrollView
and use React Fragment
or a View
to wrap them and everything should be okay.
<ScrollView>
<BottomSheet>...</BottomSheet>
</ScrollView>
<>
<ScrollView>...</ScrollView>
<BottomSheet>...</BottomSheet>
</>
The bottom sheet is highly configurable via props. All props works for both Android
and iOS
except those prefixed with android_
and ios_
, which works for only Android
and iOS
respectively.
Property | Type | Default | Description | Required |
---|---|---|---|---|
android_backdropMaskRippleColor | string | OpaqueColorValue | Color of the ripple effect when backdrop mask is pressed (Android Only). | No | |
android_closeOnBackPress | boolean | true | Determines whether the sheet will close when the device back button is pressed (Android Only). | No |
animationType | 'slide' | 'spring' | 'fade' | ANIMATIONS | 'slide' | Animation to use when opening and closing the bottom sheet. | No |
backdropMaskColor | string | OpaqueColorValue | '#00000052' | Color of the scrim or backdrop mask. | No |
children | ViewProps['children'] | React.FunctionComponent<{_animatedHeight: Animated.Value}> | null | Contents of the bottom sheet. | Yes |
closeDuration | number | 500 | Duration for sheet closing animation. | No |
closeOnBackdropPress | boolean | true | Determines whether the bottom sheet will close when the scrim or backdrop mask is pressed. | No |
closeOnDragDown | boolean | true | Determines whether the bottom sheet will close when dragged down. | No |
containerHeight | ViewStyle['height'] | DEVICE SCREEN HEIGHT | Height of the bottom sheet's overall container. | No |
customBackdropComponent | React.FunctionComponent<{_animatedHeight: Animated.Value}> | null | Custom component for sheet's scrim or backdrop mask. | No |
customBackdropPosition | "top" | "behind" | 'behind' | Determines the position of the custom scrim or backdrop component. 'behind' puts it behind the keyboard and `'top'`` puts it atop the keyboard. | No |
customDragHandleComponent | React.FC<{_animatedHeight: Animated.Value}> | Custom drag handle component to replace the default bottom sheet's drag handle. | No | |
customEasingFunction | AnimationEasingFunction | ANIMATIONS.SLIDE | Custom easing function for driving sheet's animation. | No |
disableBodyPanning | boolean | false | Prevents the bottom sheet from being dragged/panned down on its body. | No |
disableDragHandlePanning | boolean | false | Prevents the bottom sheet from being panned down by dragging its drag handle. | No |
dragHandleStyle | ViewStyle | Extra styles to apply to the drag handle. | No | |
height | number | string | '50%' | Height of the bottom sheet when opened. Relative to containerHeight prop | No |
hideDragHandle | boolean | false | When true, hides the sheet's drag handle. | No |
modal | boolean | true | Determines whether the sheet is a modal. A modal sheet has a scrim or backdrop mask, while a standard (non-modal) sheet doesn't. | No |
openDuration | number | 500 | Duration for sheet opening animation. | No |
style | Omit<ViewStyle, 'height' | 'minHeight' | 'maxHeight' | 'transform:[{translateY}]'> | Extra styles to apply to the bottom sheet. | No |
Flexibility is a focus for this bottom sheet, these few examples shows certain behaviors of the bottom sheet and what can be achieved by tweaking its props.
Android | iOS |
---|---|
Android | iOS |
---|---|
height
and containerHeight
props change (automatic behavior)
SnackBar
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
see LICENSE
</> with 💖 by Devvie ✌
FAQs
small react native bottom sheet
The npm package @amir-hossein-karimi/bottom-sheet receives a total of 11 weekly downloads. As such, @amir-hossein-karimi/bottom-sheet popularity was classified as not popular.
We found that @amir-hossein-karimi/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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.