Open antsmo opened 6 years ago
Hi @MyGuySi, that's very strange! I wonder if it's related to re-using the same config object? Can you try the following:
const NOTIFICATIONS = {
get CANCELLED() {
return {
title: "Cancelled",
duration: Snackbar.LENGTH_INDEFINITE,
backgroundColor: "#DA2446",
action: {
title: "View",
onPress: () => null
}
};
},
get COMPLETED() {
return {
title: "Completed",
duration: Snackbar.LENGTH_LONG,
backgroundColor: "#3DC217"
};
},
get REQUEST() {
return {
title: "New Request",
duration: 5000,
backgroundColor: "#5B408E",
action: {
title: "Open",
onPress: () => null
}
};
}
};
Please let me know if this changes anything. Otherwise, if you could link to a working example app I'd like to try it myself. Thanks.
Hi @cooperka, yep I tried out your suggestion and that does indeed fix it 🤔
Thank you for confirming! This bug should certainly be fixed, but luckily it's rare and easily worked around. I'd welcome a PR to address it if you have the time.
I'm not using react-native-snackbar in any of my projects currently, it was more of a research exercise so I may not be able to submit a PR straight away but if we decide to use it then I'll definitely take a stab at it 👍
Description
I've created a lookup with some configs defined for different notifications and one button to show each one. It works fine until I tap the same button a second time and then I get an error message about the background color (see below).
I should add that this is from a completely fresh React Native project.
Example