`yarn flow-check-macos` is clean.

This commit is contained in:
Tom Underhill 2020-08-02 14:55:56 -07:00
Родитель 24be28ebb2
Коммит 213fc0f19d
5 изменённых файлов: 46 добавлений и 25 удалений

Просмотреть файл

@ -10,8 +10,7 @@
// TODO(macOS ISS#2323203) // TODO(macOS ISS#2323203)
'use strict'; /* $FlowFixMe allow macOS to share iOS file */
const alertWithArgs = require('./RCTAlertManager.ios');
var RCTAlertManager = require('../BatchedBridge/NativeModules').AlertManager; module.exports = alertWithArgs;
module.exports = RCTAlertManager;

Просмотреть файл

@ -17,8 +17,6 @@ const RCTDeviceEventEmitter = require('../../EventEmitter/RCTDeviceEventEmitter'
import NativeAccessibilityManager from './NativeAccessibilityManager'; import NativeAccessibilityManager from './NativeAccessibilityManager';
const warning = require('fbjs/lib/warning');
const CHANGE_EVENT_NAME = { const CHANGE_EVENT_NAME = {
invertColorsChanged: 'invertColorsChanged', invertColorsChanged: 'invertColorsChanged',
reduceMotionChanged: 'reduceMotionChanged', reduceMotionChanged: 'reduceMotionChanged',
@ -35,6 +33,16 @@ type ChangeEventName = $Keys<{
}>; }>;
const _subscriptions = new Map(); const _subscriptions = new Map();
/**
* Sometimes it's useful to know whether or not the device has a screen reader
* that is currently active. The `AccessibilityInfo` API is designed for this
* purpose. You can use it to query the current state of the screen reader as
* well as to register to be notified when the state of the screen reader
* changes.
*
* See http://facebook.github.io/react-native/docs/accessibilityinfo.html
*/
const AccessibilityInfo = { const AccessibilityInfo = {
/** /**
* iOS only * iOS only
@ -130,7 +138,10 @@ const AccessibilityInfo = {
* *
* Same as `isScreenReaderEnabled` * Same as `isScreenReaderEnabled`
*/ */
get fetch() { get fetch(): $FlowFixMe {
console.warn(
'AccessibilityInfo.fetch is deprecated, call Accessibility.isScreenReaderEnabled instead',
);
return this.isScreenReaderEnabled; return this.isScreenReaderEnabled;
}, },
@ -159,18 +170,6 @@ const AccessibilityInfo = {
}; };
}, },
removeEventListener: function(
eventName: ChangeEventName,
handler: Function,
): void {
const listener = _subscriptions.get(handler);
if (!listener) {
return;
}
listener.remove();
_subscriptions.delete(handler);
},
/** /**
* Set accessibility focus to a react component. * Set accessibility focus to a react component.
* *
@ -192,6 +191,23 @@ const AccessibilityInfo = {
NativeAccessibilityManager.announceForAccessibility(announcement); NativeAccessibilityManager.announceForAccessibility(announcement);
} }
}, },
/**
* Remove an event handler.
*
* See http://facebook.github.io/react-native/docs/accessibilityinfo.html#removeeventlistener
*/
removeEventListener: function(
eventName: ChangeEventName,
handler: Function,
): void {
const listener = _subscriptions.get(handler);
if (!listener) {
return;
}
listener.remove();
_subscriptions.delete(handler);
},
}; };
module.exports = AccessibilityInfo; module.exports = AccessibilityInfo;

Просмотреть файл

@ -12,7 +12,7 @@
'use strict'; 'use strict';
const React = require('react'); const React = require('react');
/* $FlowFixMe(>=0.99.0 site=react_native_ios_fb) This comment suppresses an /* $FlowFixMe(>=0.99.0 site=react_native_ios_fb,react_native_macos_fb) This comment suppresses an
* error found when Flow v0.99 was deployed. To see the error, delete this * error found when Flow v0.99 was deployed. To see the error, delete this
* comment and run Flow. */ * comment and run Flow. */
const DrawerLayoutAndroid = require('../DrawerLayoutAndroid.android'); const DrawerLayoutAndroid = require('../DrawerLayoutAndroid.android');

Просмотреть файл

@ -12,7 +12,7 @@
'use strict'; 'use strict';
const React = require('react'); const React = require('react');
/* $FlowFixMe(>=0.99.0 site=react_native_ios_fb) This comment suppresses an /* $FlowFixMe(>=0.99.0 site=react_native_ios_fb,react_native_macos_fb) This comment suppresses an
* error found when Flow v0.99 was deployed. To see the error, delete this * error found when Flow v0.99 was deployed. To see the error, delete this
* comment and run Flow. */ * comment and run Flow. */
const ProgressBarAndroid = require('../ProgressBarAndroid.android'); const ProgressBarAndroid = require('../ProgressBarAndroid.android');

Просмотреть файл

@ -14,15 +14,17 @@
import NativePlatformConstantsMacOS from './NativePlatformConstantsMacOS'; import NativePlatformConstantsMacOS from './NativePlatformConstantsMacOS';
export type PlatformSelectSpec<D, I> = { export type PlatformSelectSpec<D, N, I> = {
default?: D, default?: D,
native?: N,
macos?: I, macos?: I,
...
}; };
const Platform = { const Platform = {
__constants: null, __constants: null,
OS: 'macos', OS: 'macos',
get Version(): $FlowFixMe { get Version(): string {
return this.constants.osVersion; return this.constants.osVersion;
}, },
get constants(): {| get constants(): {|
@ -50,8 +52,12 @@ const Platform = {
} }
return false; return false;
}, },
select: <D, I>(spec: PlatformSelectSpec<D, I>): D | I => select: <D, N, I>(spec: PlatformSelectSpec<D, N, I>): D | N | I =>
'macos' in spec ? spec.macos : spec.default, 'macos' in spec
? spec.macos
: 'native' in spec
? spec.native
: spec.default,
}; };
module.exports = Platform; module.exports = Platform;