Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
https://github.com/user-attachments/assets/c857eb8d-3ce7-4afe-b2dd-e974560684d8
The fastest way to improve your React Native app is by using tap gestures. That's why I've created pressto, a super-simple package to help you get started.
The package is built on top of the Tap Gesture from react-native-gesture-handler to handle the resulting gestures and animations on the main thread. It aims to replace your “TouchableOpacity”.
yarn add pressto react-native-reanimated react-native-gesture-handler
Or with Expo
npx expo install pressto react-native-reanimated react-native-gesture-handler
PressableScale
and PressableOpacity
createAnimatedPressable
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { PressableOpacity, PressableScale } from 'pressto';
function BasicPressablesExample() {
return (
<View style={styles.container}>
<PressableScale style={styles.box} onPress={() => console.log('scale')} />
<PressableOpacity
style={styles.box}
onPress={() => console.log('opacity')}
/>
</View>
);
}
import { createAnimatedPressable } from 'pressto';
const PressableRotate = createAnimatedPressable((progress) => {
'worklet';
return {
transform: [{ rotate: `${(progress.value * Math.PI) / 4}rad` }],
};
});
function CustomPressableExample() {
return (
<View style={styles.container}>
<PressableRotate
style={styles.box}
onPress={() => console.log('rotate')}
/>
</View>
);
}
import React from 'react';
import { gestureHandlerRootHOC } from 'react-native-gesture-handler';
import { PressablesConfig } from 'pressto';
function App() {
return (
<View style={styles.container}>
<PressableRotate
style={styles.box}
onPress={() => console.log('rotate')}
/>
<PressableScale style={styles.box} onPress={() => console.log('scale')} />
<PressableOpacity
style={styles.box}
onPress={() => console.log('opacity')}
/>
</View>
);
}
export default () => (
<PressablesConfig
animationType="spring"
config={{ mass: 2 }}
globalHandlers={{
onPress: () => {
console.log('you can call haptics here');
},
}}
>
<App />
</PressablesConfig>
);
A pressable component that scales when pressed.
A pressable component that changes opacity when pressed.
A function to create custom animated pressables. It takes a worklet function that defines how the component should animate based on the press progress.
A component to configure global settings for all pressable components within its children.
pressto
provides an optional custom scroll render component that enhances the scrolling experience when used with pressable components.
import { renderScrollComponent } from 'pressto';
import { FlatList } from 'react-native';
function App() {
return (
// This works with all the lists that support the renderScrollComponent prop
<FlatList
renderScrollComponent={renderScrollComponent}
data={data}
renderItem={({ item }) => <PressableRotate style={styles.box} />}
/>
);
}
The renderScrollComponent
function wraps the scroll view with additional functionality in order to allow smoother interactions between scrolling and pressable components, preventing unwanted activations during scroll gestures.
Applying the renderScrollComponent from pressto
means that the tap gesture will be delayed for a short amount of time to understand if the tap gesture is a scroll or a tap gesture.
Contributions are welcome! Please see our contributing guide for more details.
MIT
Made with ❤️ using create-react-native-library
FAQs
Some custom react native touchables
The npm package pressto receives a total of 264 weekly downloads. As such, pressto popularity was classified as not popular.
We found that pressto 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.