Comments (8)
You use something like that:
import FlashMessage from "react-native-flash-message";
class App extends React.Component {
componentDidMount() {
FlashMessage.setColorTheme({
success: "#25c879",
info: "#75a4f6",
warning: "#ff9398",
danger: "#d990fb",
});
}
render() {
return <View />; // YOUR LAYOUT APP HERE
}
}
setColorTheme
it's a static method from FlashMessage component, you can call then in your top app structure like I did in the sample above.
So next time ahead in your code when you call showMessage({ type: "success", message: title, description:message}
your message will be shown with color "#25c879".
Please try over there and feedback me if it works ;)
from react-native-flash-message.
Hi @alexakasanjeev,
Your PR will be very welcome ;)
from react-native-flash-message.
Hi @mozibrand
Colors are defined here:
https://github.com/lucasferreira/react-native-flash-message/blob/master/src/FlashMessage.js#L344
As a static variable in Component they are defined globally. You could customize globally using setColorTheme
or when you call showMessage
you could pass a custom background color or font color.
It's that your question?
from react-native-flash-message.
Thank you for your answer, but I'm not quite sure how to do it, like, should I write it like this:
showMessage({
type: state,
message: title,
description:message,
setColorTheme: {
success: "#25c879",
info: "#75a4f6",
warning: "#ff9398",
danger: "#d990fb",
}
});
It didn't work
from react-native-flash-message.
Please tell me how it is implemented,thank you ver much
from react-native-flash-message.
Thank you very much for your contribution,Is very perfect
from react-native-flash-message.
You're welcome ;)
from react-native-flash-message.
@lucasferreira Can I update Readme file, mentioning this static method, and how to change color, I mean, we don't have to look at source code or search issue, for this
I want to make two edits in README, can I contribute this?
- Mention how to change color
- Rename
Props
title toFlashMessage component Props
(this will just remove ambiguity)
from react-native-flash-message.
Related Issues (20)
- Does not render only on IOS HOT 3
- Not support iPhone 14 HOT 11
- Does not run on a CASIO Handheld running Android 8 HOT 4
- Show Toast Message always appears behind the modal in iOS when it is open using react-navigation 6.x HOT 13
- Flash message not shown on Android 9 (Sony Xperia Z1) HOT 5
- Invalid prop `icon` supplied to `FlashMessage`, expected one of type [string, object]. HOT 1
- Android cutoff HOT 5
- Warning: Failed prop type: The prop `message.message` is marked as required in `ForwardRef`, but its value is `undefined`.
- MessageOptions and MessageComponentProps interfaces are incorrect HOT 2
- How to test this component with RNTL? HOT 6
- Updating icon props to allow JSX.Element callback HOT 5
- custom icon not working
- Không thể xoá paddingTop HOT 1
- Try it out not working - Error on Snack
- FEATURE REQUEST: Persistent FlashMessage HOT 4
- Message disappers quickly in iOS
- onPress not triggered with TouchableWithoutFeedback - Pressable works
- Unable to show custom icon in the toast HOT 1
- closing a modal window by moving up
- Support for dynamic island on iOS? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-flash-message.