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

41 lines (35 loc) 1.12 kB
/* * Copyright © 2022 S20.AI India Pvt. Ltd. * Contact - origin@s20.ai * License - Licensed as per https://docs.s20.ai/license.html */ import types from '../actions/types'; import constants from '../../config/constants'; import {Dimensions} from 'react-native'; const {height, width} = Dimensions.get('window'); const initialState = { present: { type: constants.EXTERIOR_VIEW, }, previous: null, widgetsVisible: true, orientation: height >= width ? constants.PORTRAIT : constants.LANDSCAPE, }; const currentViewReducer = (state = initialState, action) => { switch (action.type) { case types.VIEW.SET_CURRENT_VIEW: state = {...state, present: action.data, previous: state.present}; return state; case types.VIEW.CLEAR_CURRENT_VIEW: return initialState; case types.VIEW.SET_WIDGETS_VISIBILITY: state = {...state, widgetsVisible: action.data}; return state; case types.VIEW.SET_CURRENT_ORIENTATION: state = {...state, orientation: action.data}; return state; default: return state; } }; export default currentViewReducer;