Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@nuskin/bottom-sheet
Advanced tools
React Native library for a customized BottomSheetModal built with react-native-bottom-sheet.
yarn add @ns/mobile-ui
The BottomSheetModal depends on React Native Reanimated which requires some additional setup, primarily on Android:
React Native Reanimated Per the official docs
android/app/build.gradle
project.ext.react = [
enableHermes: true // <- here | clean and rebuild if changing
]
import com.facebook.react.bridge.JSIModulePackage; // <- add
import com.swmansion.reanimated.ReanimatedJSIModulePackage; // <- add
...
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
...
@Override
protected String getJSMainModuleName() {
return "index";
}
@Override
protected JSIModulePackage getJSIModulePackage() {
return new ReanimatedJSIModulePackage(); // <- add
}
};
...
Run pod install in the ios/
directory.
Add Reanimated's babel plugin to your babel.config.js and make sure it is listed last:
module.exports = {
...
plugins: [
...
'react-native-reanimated/plugin',
],
};
The BottomSheetModal must be wrapped in a BottomSheetModalProvider and GestureHandlerRootView. For more information, see the official docs for react-native-bottom-sheet and react-native-gesture-handler. Note that this library uses Bottom Sheet Modal, a wrapper/decorator on top of the Bottom Sheet component shipped by react-native-bottom-sheet. If the BottomSheetModal will be used throughout your app, we recommend wrapping your entry point with the BottomSheetModalProvider and GestureHandlerRootView:
import { BottomSheetModalProvider, ShareModal } from '@ns/mobile-ui'
import { GestureHandlerRootView } from 'react-native-gesture-handler'
// ...
export default function App() {
// ...
return (
<GestureHandlerRootView style={{ flex: 1 }}>
<BottomSheetModalProvider>...</BottomSheetModalProvider>
</GestureHandlerRootView>
)
}
Define and set a ref for the modal. To show the BottomSheetModal, call the showSheet
function shipped by this package, or use the methods shipped by react-native-bottom-sheet (see methods). Our BottomSheetModal can be further customized by passing any props supported by react-native-bottom-sheet (see props)
import React, { useRef } from 'react'
import { BottomSheetModal, BottomSheetModalType } from 'nuskin/ui'
import { View, Text, Button, StyleSheet } from 'react-native'
export const Example = () => {
// ref
const bottomSheetModalRef = useRef < BottomSheetModalType > null
// variables
const snapPoints = useMemo(() => ['25%', '50%'], [])
// callbacks
const handlePresentModalPress = useCallback(() => {
bottomSheetModalRef.current?.present()
}, [])
const handleSheetChanges = useCallback((index: number) => {
console.log('handleSheetChanges', index)
}, [])
// renders
return (
<BottomSheetModal
ref={bottomSheetModalRef}
index={0}
snapPoints={snapPoints}
onChange={handleSheetChanges}
>
<View style={styles.contentContainer}>
<Text>Awesome Example 🎉</Text>
<Button onPress={handlePresentModalPress} title="Present Modal" />
</View>
</BottomSheetModal>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 24,
justifyContent: 'center',
backgroundColor: 'grey'
},
contentContainer: {
flex: 1,
alignItems: 'center'
}
})
FAQs
Unknown package
The npm package @nuskin/bottom-sheet receives a total of 114 weekly downloads. As such, @nuskin/bottom-sheet popularity was classified as not popular.
We found that @nuskin/bottom-sheet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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.