You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.js 981B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // @flow
  2. import { _SET_APP_STATE_LISTENER, APP_STATE_CHANGED } from './actionTypes';
  3. /**
  4. * Sets the listener to be used with React Native's AppState API.
  5. *
  6. * @param {Function} listener - Function to be set as the change event listener.
  7. * @protected
  8. * @returns {{
  9. * type: _SET_APP_STATE_LISTENER,
  10. * listener: Function
  11. * }}
  12. */
  13. export function _setAppStateListener(listener: ?Function) {
  14. return {
  15. type: _SET_APP_STATE_LISTENER,
  16. listener
  17. };
  18. }
  19. /**
  20. * Signals that the App state has changed (in terms of execution state). The
  21. * application can be in 3 states: 'active', 'inactive' and 'background'.
  22. *
  23. * @param {string} appState - The new App state.
  24. * @public
  25. * @returns {{
  26. * type: APP_STATE_CHANGED,
  27. * appState: string
  28. * }}
  29. * @see {@link https://facebook.github.io/react-native/docs/appstate.html}
  30. */
  31. export function appStateChanged(appState: string) {
  32. return {
  33. type: APP_STATE_CHANGED,
  34. appState
  35. };
  36. }