• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

facebook / react-native / f1c4254b-5ba8-42c9-967e-ce471fa17ef4

pending completion
f1c4254b-5ba8-42c9-967e-ce471fa17ef4

push

CircleCI

Facebook GitHub Bot
Changing the Loading View of Android to rely on the native implementation instead of Toast (#35773)

3633 of 26419 branches covered (13.75%)

Branch coverage included in aggregate %.

16 of 16 new or added lines in 1 file covered. (100.0%)

7424 of 44605 relevant lines covered (16.64%)

242.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Libraries/Utilities/LoadingView.android.js
1
/**
2
 * Copyright (c) Meta Platforms, Inc. and 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

11
import ToastAndroid from '../Components/ToastAndroid/ToastAndroid';
×
12
import processColor from '../StyleSheet/processColor';
×
13
import Appearance from './Appearance';
×
14
import NativeDevLoadingView from './NativeDevLoadingView';
×
15

16
const TOAST_SHORT_DELAY = 2000;
×
17
let isVisible = false;
×
18

19
module.exports = {
×
20
  showMessage(message: string, type: 'load' | 'refresh') {
21
    if (NativeDevLoadingView) {
×
22
      let backgroundColor;
23
      let textColor;
24

25
      if (type === 'refresh') {
×
26
        backgroundColor = processColor('#2584e8');
×
27
        textColor = processColor('#ffffff');
×
28
      } else if (type === 'load') {
×
29
        if (Appearance.getColorScheme() === 'dark') {
×
30
          backgroundColor = processColor('#fafafa');
×
31
          textColor = processColor('#242526');
×
32
        } else {
33
          backgroundColor = processColor('#404040');
×
34
          textColor = processColor('#ffffff');
×
35
        }
36
      }
37

38
      NativeDevLoadingView.showMessage(
×
39
        message,
40
        typeof textColor === 'number' ? textColor : null,
×
41
        typeof backgroundColor === 'number' ? backgroundColor : null,
×
42
      );
43
    } else if (!isVisible) {
×
44
      ToastAndroid.show(message, ToastAndroid.SHORT);
×
45
      isVisible = true;
×
46
      setTimeout(() => {
×
47
        isVisible = false;
×
48
      }, TOAST_SHORT_DELAY);
49
    }
50
  },
51
  hide() {
52
    NativeDevLoadingView && NativeDevLoadingView.hide();
×
53
  },
54
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc