Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
react-native-snackbar-android
Advanced tools
react-native-snackbar-android is a React Native library for Snackbar on Android.
$ yarn add react-native-snackbar-android
or
$ npm install react-native-snackbar-android --save
$ yarn add react-native-snackbar-android
or
$ npm install react-native-snackbar-android --save
$ react-native link react-native-snackbar-android
android/app/src/main/java/[...]/MainApplication.java
import com.thebylito.reactnativesnackbar.ReactNativeSnackBarPackage;
to the imports at the top of the filenew ReactNativeSnackBarPackage()
to the list returned by the getPackages()
methodandroid/settings.gradle
:
include ':react-native-snackbar-android'
project(':react-native-snackbar-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-snackbar-android/android')
android/app/build.gradle
:
compile project(':react-native-snackbar-android')
android/app/build.gradle
:
compileSdkVersion 27
buildToolsVersion "27.0.1"
targetSdkVersion 27
android/build.gradle
:
buildscript {
repositories {
...
maven {
url 'https://maven.google.com/'
name 'Google'
}
...
}
AND
allprojects {
repositories {
...
maven {
url 'https://maven.google.com/'
name 'Google'
}
...
}
}
Android Implementation
import React, { Component } from "react";
import SnackBar, { duration } from "react-native-snackbar-android";
import { Text, View } from "react-native";
export default class App extends Component {
componentDidMount() {
SnackBar.show({
message: "Hello Word",
backgroundColor: "red",
duration: duration.LENGTH_LONG,
onShow: () => {
console.log("SHOW");
},
onHide: () => {
console.log("HIDE");
},
action: {
title: "My Button",
txtColor: "white",
onPress: () => {
alert("You Press ME!");
}
}
});
}
render() {
return (
<View style={styles.container}>
<Text>Hello Word</Text>
</View>
);
}
}
PS.: Supported colors formats are: #RRGGBB #AARRGGBB
The following names are also accepted: red, blue, green, black, white, gray, cyan, magenta, yellow, lightgray, darkgray, grey, lightgrey, darkgrey, aqua, fuchsia, lime, maroon, navy, olive, purple, silver, and teal.
show(options) :(Android)
Show SnackBar
{
message: String with text to show,
duration: can be int number in miliseconds or import {duration}, // Required
backgroundColor: color of background color of SnackBar, // No required
onShow: Function on Show Snackbar, // No required
onHide: Function on Hide Snackbar, // No required
action: { // No required
title: String with text to button, // Required
onPress: Function on click button, // No required
txtColor: The color of button text, // No required
},
};
SnackBar.show({
message: "Hello Word"
});
SnackBar.show({
message: "Hello Word",
backgroundColor: "red",
action: {
title: "My Button",
onPress: () => {
alert("You Press ME!");
}
}
});
MIT
FAQs
A SnackBar component for Android
The npm package react-native-snackbar-android receives a total of 1 weekly downloads. As such, react-native-snackbar-android popularity was classified as not popular.
We found that react-native-snackbar-android demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.