databag/app/mobile/src/session/useSession.hook.js

30 lines
679 B
JavaScript
Raw Normal View History

2022-09-16 20:06:52 +00:00
import { useState, useEffect, useContext } from 'react';
import { useWindowDimensions } from 'react-native';
import { useNavigate } from 'react-router-dom';
import { AppContext } from 'context/AppContext';
2022-09-17 07:22:12 +00:00
import config from 'constants/Config';
2022-09-16 20:06:52 +00:00
export function useSession() {
const [state, setState] = useState({
2022-09-17 07:22:12 +00:00
tabbled: null,
2022-09-16 20:06:52 +00:00
});
2022-09-17 07:22:12 +00:00
const dimensions = useWindowDimensions();
2022-09-16 20:06:52 +00:00
const app = useContext(AppContext);
const navigate = useNavigate();
const updateState = (value) => {
setState((s) => ({ ...s, ...value }));
}
2022-09-17 07:22:12 +00:00
useEffect(() => {
updateState({ tabbed: false });
}, [dimensions]);
2022-09-16 20:06:52 +00:00
const actions = {
};
return { state, actions };
}