UNPKG

@s20.ai/safecam-360-rn

Version:

A React Native component to view the interior panorama and exterior 360 degree views of a product featuring suppport for hotspots. Compatible with Android and iOS

42 lines (39 loc) 947 B
import constants from "../../config/constants"; import types from "../actions/types"; const initialState = () => { let initialState = {}; Object.keys(constants.MESSAGES).forEach( (d) => (initialState[d] = { show: false, never: false, }) ); return initialState; }; const messageHintReducer = (state = initialState(), action) => { switch (action.type) { case types.MESSAGE.SET_CURRENT_MESSAGE_ON: return { ...state, [action.data]: { ...state[action.data], show: true, }, }; case types.MESSAGE.SET_CURRENT_MESSAGE_OFF: if (action.data === "all") return initialState; return { ...state, [action.data]: { show: false, never: action.primary, }, }; case types.MESSAGE.CLEAR_CURRENT_MESSAGE: return; default: return state; } }; export default messageHintReducer;