import React from 'react'; import { SafeAreaView, ScrollView, StatusBar, StyleSheet, Text, Image, TouchableOpacity, View, } from 'react-native'; import { setMapConfig } from '../../redux/actiions'; import Store from '../../utils/Store'; import { BjTypeMapConfig } from '../../utils/types'; import redux from '../../redux/store'; interface Props { } interface State { } export default class InitReduxTask extends React.PureComponent { constructor(props: Props) { super(props); }; public readonly state: Readonly = { }; componentDidMount() { const defaultMapConfig: BjTypeMapConfig = { layerType: 'outdoor', showVe: false, showRiver: false, showResearchLine: false, showResearchPlot: false, showRiverLabel: false, showVeLabel: false }; Store.getJsonObject('mapConfig') .then(res => { if (!res.layerType) { res = { ...defaultMapConfig, ...res }; } console.log("mapConfig-------->", res) redux.dispatch(setMapConfig(res)); }) .catch(e => { redux.dispatch(setMapConfig(defaultMapConfig)) }); } render() { return ( ) } }