import * as React from 'react'; import { connect } from 'react-redux'; import { Ionicons } from '@expo/vector-icons'; import { BasicLayout, Settings } from '../../components'; import { useNavigate } from 'react-router-native'; import { useSelector } from 'react-redux'; import { CHANGE_SETTINGS_ACTION } from '@admin-layout/client'; export interface ReduxState { settings: Settings; } const Layout: React.FC = (props) => { const user = useSelector((state: any) => state?.user); const { settings } = props; const navigate = useNavigate(); const logout = () => { navigate('/logout'); }; return ( { if (route.path.split('/').pop() === props.location.pathname.split('/').pop()) { return route; } else if ( route.path.split('/')[route.path.split('/').length - 2] === props.location.pathname.split('/')[props.location.pathname.split('/').length - 2] ) { return route; } })} rightContentRender={(rightProps) => { return ( logout()} /> ); }} /> ); }; export default connect( ({ settings, router }: any) => ({ settings, location: router.location, }), (dispatch) => ({ onSettingChange: (data: any) => dispatch({ type: CHANGE_SETTINGS_ACTION, payload: data, }), }), )(Layout);