
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
react-native-paper-message-context
Advanced tools
Uses react-native-paper to show messages (in form of dialog or snack) in an easy n fast form. (includes predefined styles and configuration)
Uses react-native-paper to show messages (in form of dialog or snack) in an easy n fast form. (includes predefined styles and configuration)
This module needs to have instaled
This module uses components from react-native-paper, so if you found a visual bug (like a snackbar that shows on top
of the screen) instead of a possible message-context bug (like a dialog not showing the correct color), but that
issue also in react-native-paper.
Just run in your console
npm i react-native-paper-message-context
To use first import the MessageProvider inside your PaperProvider. If you want to handle dinamic DarkTheme
I recommend you to install react-native-paper-navigation-theme-context.
import React from 'react'
import {Provider as PaperProvider} from 'react-native-paper'
import {MessageProvider} from 'react-native-paper-message-context'
// This is suposed to be your app
import Screen from './Screen'
const App = () => {
return (
<PaperProvider>
<MessageProvider>
<Screen/>
</MessageProvider>
</PaperProvider>
)
}
export default App
Once made this, use the hook useMessage() to show a message.
// ...
import {useMessage} from 'react-native-paper-message-context'
const CustomComponent = () => {
const {showMessage} = useMessage()
return (
<Button onPress={()=>showMessage('Hello World')}>Show Message</Button>
)
}
export default CustomComponent
You can customize a little your messages with the optional parameter options:
large in true, it will have a larger duration (snack)
(default is false).static is true, this will not
happen (dialog) (default is false).undefined, uses
the PaperProvider primary color). In versions 1.2.0+ it can also CSS color names like 'red', 'hotpink' or 'gold'.'OK').Maybe you're confused because I said that the options are for a Snack or Dialog, let me explain. For default
showMessage() shows a Dialog, but you can change this using useSnackForMessages and useDialogForMessages.
// ...
import {MessageProvider, useMessage} from 'react-native-paper-message-context'
const WithSnack = ({children}) => {
const {useSnackForMessages} = useMessage()
useSnackForMessages()
return (
<>
{children}
</>
)
}
// Now any showMessage() call inside <WithSnack> will be a Snack instead of a Dialog
const App = () => {
return (
<PaperProvider>
<MessageProvider>
<WithSnack>
<Screen>
</WithSnack>
</MessageProvider>
</PaperProvider>
)
}
Another option if you don't want to make all of this, useMessage() provides also two functions to show
specificaly a Dialog or a Snack: showSnack() and showDialog().
// ...
const CustomComponent = () => {
const {showSnack, showDialog} = useMessage()
return (
<View>
<Button onPress={()=>showSnack('Nice',{color:'success'})}>
Show a Snack saying something went fine
</Button>
<Button onPress={()=>showDialog('Error',{color:'danger'})}>
Show a Dialog saying something went very wrong
</Button>
</View>
)
}
export default CustomComponent
In version 1.1.0+, there's a new dialog used to make actions if the yes button is pressed, its called Ask.
// ...
const CustomComponent = () => {
const {ask, showMessage} = useMessage()
const hackNASA = () => {
showMessage('NASA Hacked',{color:'success'})
}
const askToLog = () => {
ask('Are you sure you wanna hack the NASA?',hackNASA,undefined,{
color:'warning',
label:['NEVER','YES PLEASE']
})
}
return (
<View>
<Button onPress={askToLog}>start hack</Button>
</View>
)
}
export default CustomComponent
FAQs
Uses react-native-paper to show messages (in form of dialog or snack) in an easy n fast form. (includes predefined styles and configuration)
We found that react-native-paper-message-context 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.