mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
d974793b59
Summary: This adds a loading indicator when loading split bundles so that users get a visual indicator about what is going on. Note that I am currently trying to get the dynamic message that shows the number of modules and percentage to work but it appears that the JavaScript networking client (XMLHttpRequest + RCTNetwork) are not set up to deal with multipart responses in the same way as our native multipart handlers are. I'd like to put this in place now and polish it later if it's possible to fix the issue (I spent all afternoon yesterday trying to make multipart messages work and failed :( ). Reviewed By: gaearon Differential Revision: D16281531 fbshipit-source-id: 84e53d7f25642398ed51d8f552919880b8090897
30 lines
639 B
JavaScript
30 lines
639 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @flow
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
import ToastAndroid from '../Components/ToastAndroid/ToastAndroid';
|
|
|
|
const TOAST_SHORT_DELAY = 2000;
|
|
let isVisible = false;
|
|
|
|
module.exports = {
|
|
showMessage(message: string, type: 'load' | 'refresh') {
|
|
if (!isVisible) {
|
|
ToastAndroid.show(message, ToastAndroid.SHORT);
|
|
isVisible = true;
|
|
setTimeout(() => {
|
|
isVisible = false;
|
|
}, TOAST_SHORT_DELAY);
|
|
}
|
|
},
|
|
hide() {},
|
|
};
|