Files
react-native/Libraries/Utilities/LoadingView.ios.js
T
Ramanpreet Nara 6a9a76e420 Make RCTDevLoadingView TurboModule-compatible
Summary:
This is a redo of D16969764, with a few extensions.

## Changes
1. Move `RCTDevLoadingView.{h,m}` to `CoreModuels/RCTDevLoadingView.{h,mm}`
2. Extract ObjC API of `RCTDevLodingView` into `RCTDevLoadingViewProtocol` in `ReactInternal`.
3. Create API `RCTDevLoadingViewSetEnabled.h` in `ReactInternal` to enable/disable `RCTDevLoadingView`

Changelog:
[iOS][Added] - Make RCTDevLoadingView TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18642554

fbshipit-source-id: 6b62e27e128d98254b7a6d018399ec1c06e274fc
2020-02-27 17:06:13 -08:00

41 lines
1.0 KiB
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 strict-local
*/
'use strict';
import processColor from '../StyleSheet/processColor';
import NativeDevLoadingView from './NativeDevLoadingView';
module.exports = {
showMessage(message: string, type: 'load' | 'refresh') {
if (NativeDevLoadingView) {
const green = processColor('#275714');
const blue = processColor('#2584e8');
const white = processColor('#ffffff');
NativeDevLoadingView.showMessage(
message,
// Use same colors as iOS "Personal Hotspot" bar.
typeof white === 'number' ? white : null,
type && type === 'load'
? typeof green === 'number'
? green
: null
: typeof blue === 'number'
? blue
: null,
);
}
},
hide() {
NativeDevLoadingView && NativeDevLoadingView.hide();
},
};