Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

reducer.ts 913B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { NativeEventSubscription } from 'react-native';
  2. import ReducerRegistry from '../../base/redux/ReducerRegistry';
  3. import { APP_STATE_CHANGED, _SET_APP_STATE_SUBSCRIPTION } from './actionTypes';
  4. export interface IMobileBackgroundState {
  5. appState: string;
  6. subscription?: NativeEventSubscription;
  7. }
  8. /**
  9. * The default/initial redux state of the feature background.
  10. */
  11. const DEFAULT_STATE = {
  12. appState: ''
  13. };
  14. // eslint-disable-next-line max-len
  15. ReducerRegistry.register<IMobileBackgroundState>('features/mobile/background', (state = DEFAULT_STATE, action): IMobileBackgroundState => {
  16. switch (action.type) {
  17. case _SET_APP_STATE_SUBSCRIPTION:
  18. return {
  19. ...state,
  20. subscription: action.subscription
  21. };
  22. case APP_STATE_CHANGED:
  23. return {
  24. ...state,
  25. appState: action.appState
  26. };
  27. }
  28. return state;
  29. });