From 9ebc5e466871cfb4510adf177f4ba808b4f008da Mon Sep 17 00:00:00 2001 From: Bart Akeley Date: Sat, 24 Nov 2018 10:43:26 -0600 Subject: [PATCH] snackbar on food item creation success --- js/enhancers/createFoodItemEnhancers.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/enhancers/createFoodItemEnhancers.js b/js/enhancers/createFoodItemEnhancers.js index 66f9859..a99a59c 100644 --- a/js/enhancers/createFoodItemEnhancers.js +++ b/js/enhancers/createFoodItemEnhancers.js @@ -4,6 +4,7 @@ import CreateFoodItem$, { emitter as emitCreateItemState } from '../streams/Crea import { emitter as emitFoodItemsState } from '../streams/FoodItemsStream'; import { createFoodItem } from '../apis/FoodItemsApi'; import FoodItemRecord, { createFoodItem as buildFoodItem } from '../records/FoodItemRecord'; +import Snackbar from 'react-native-snackbar'; // should throw an error if not valid const isFoodItemValid = () => true; @@ -21,6 +22,10 @@ export const withCreateFoodItemState = mapPropsStream(props$ => { // insert new item into db and cast it into FoodItemRecord const newItem = buildFoodItem(await createFoodItem(foodItem)); + Snackbar.show({ + title: foodItem.name + ' added', + }); + // notify food items state of new item emitFoodItemsState(newItem);