LoadingView.android.js 652 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow strict-local
  9. */
  10. 'use strict';
  11. import ToastAndroid from '../Components/ToastAndroid/ToastAndroid';
  12. const TOAST_SHORT_DELAY = 2000;
  13. let isVisible = false;
  14. module.exports = {
  15. showMessage(message: string, type: 'load' | 'refresh') {
  16. if (!isVisible) {
  17. ToastAndroid.show(message, ToastAndroid.SHORT);
  18. isVisible = true;
  19. setTimeout(() => {
  20. isVisible = false;
  21. }, TOAST_SHORT_DELAY);
  22. }
  23. },
  24. hide() {},
  25. };