Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

Expand Down Expand Up @@ -49,6 +49,7 @@ export type ShareActionSheetIOSOptions = Readonly<{
export type ShareActionSheetError = Readonly<{
domain: string,
code: string,
// $FlowFixMe[unclear-type]
userInfo?: ?Object,
message: string,
}>;
Expand Down Expand Up @@ -155,7 +156,9 @@ const ActionSheetIOS = {
*/
showShareActionSheetWithOptions(
options: ShareActionSheetIOSOptions,
// $FlowFixMe[unclear-type]
failureCallback: Function | ((error: ShareActionSheetError) => void),
// $FlowFixMe[unclear-type]
successCallback: Function | ((success: boolean, method: ?string) => void),
) {
invariant(
Expand Down
9 changes: 8 additions & 1 deletion packages/react-native/Libraries/Alert/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

Expand All @@ -26,6 +26,7 @@ export type AlertButtonStyle = 'default' | 'cancel' | 'destructive';

export type AlertButton = {
text?: string,
// $FlowFixMe[unclear-type]
onPress?: ?((value?: string) => any) | ?Function,
isPreferred?: boolean,
style?: AlertButtonStyle,
Expand Down Expand Up @@ -121,6 +122,7 @@ class Alert {
cancelable: false,
};

// $FlowFixMe[sketchy-null-bool]
if (options && options.cancelable) {
config.cancelable = options.cancelable;
}
Expand All @@ -141,6 +143,7 @@ class Alert {
config.buttonNegative = buttonNegative.text || '';
}
if (buttonPositive) {
// $FlowFixMe[sketchy-null-string]
config.buttonPositive = buttonPositive.text || defaultPositiveText;
}

Expand Down Expand Up @@ -186,6 +189,7 @@ class Alert {
options?: AlertOptions,
): void {
if (Platform.OS === 'ios') {
// $FlowFixMe[unclear-type]
let callbacks: Array<?any> = [];
const buttons = [];
let cancelButtonKey;
Expand All @@ -201,9 +205,11 @@ class Alert {
} else if (btn.style === 'destructive') {
destructiveButtonKey = String(index);
}
// $FlowFixMe[sketchy-null-bool]
if (btn.isPreferred) {
preferredButtonKey = String(index);
}
// $FlowFixMe[sketchy-null-string]
if (btn.text || index < (callbackOrButtons || []).length - 1) {
const btnDef: {[number]: string} = {};
btnDef[index] = btn.text || '';
Expand All @@ -215,6 +221,7 @@ class Alert {
alertWithArgs(
{
title: title || '',
// $FlowFixMe[sketchy-null-string]
message: message || undefined,
buttons,
type: type || undefined,
Expand Down
4 changes: 3 additions & 1 deletion packages/react-native/Libraries/Blob/File.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

// flowlint unsafe-getters-setters:off

'use strict';

import type {BlobOptions} from './BlobTypes';
Expand Down
4 changes: 3 additions & 1 deletion packages/react-native/Libraries/Blob/FileReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

// flowlint unsafe-getters-setters:off

import type {EventCallback} from '../../src/private/webapis/dom/events/EventTarget';
import type Blob from './Blob';

Expand Down
16 changes: 10 additions & 6 deletions packages/react-native/Libraries/Blob/URL.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

// flowlint unsafe-getters-setters:off

import type Blob from './Blob';

import NativeBlobModule from './NativeBlobModule';
Expand Down Expand Up @@ -79,6 +81,7 @@ export class URL {
// $FlowFixMe[missing-local-annot]
constructor(url: string, base?: string | URL) {
let baseUrl = null;
// $FlowFixMe[sketchy-null-string]
if (!base || validateBaseUrl(url)) {
this._url = url;
if (this._url.includes('#')) {
Expand Down Expand Up @@ -112,13 +115,14 @@ export class URL {
if (baseUrl.endsWith('/')) {
baseUrl = baseUrl.slice(0, baseUrl.length - 1);
}
if (!url.startsWith('/')) {
url = `/${url}`;
let path = url;
if (!path.startsWith('/')) {
path = `/${path}`;
}
if (baseUrl.endsWith(url)) {
url = '';
if (baseUrl.endsWith(path)) {
path = '';
}
this._url = `${baseUrl}${url}`;
this._url = `${baseUrl}${path}`;
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/react-native/Libraries/Blob/URLSearchParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

// flowlint unsafe-getters-setters:off

// Small subset from whatwg-url: https://github.com/jsdom/whatwg-url/tree/master/src
// The reference code bloat comes from Unicode issues with URLs, so those won't work here.
export class URLSearchParams {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

Expand Down Expand Up @@ -115,7 +115,7 @@ const ActivityIndicator: component(
style,
...restProps
}: {
ref?: any,
ref?: React.RefSetter<ActivityIndicatorInstance>,
...ActivityIndicatorProps,
}) => {
let sizeStyle;
Expand Down
11 changes: 7 additions & 4 deletions packages/react-native/Libraries/Components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

Expand Down Expand Up @@ -232,7 +232,7 @@ const Button: component(
} = props;
const buttonStyles: Array<ViewStyleProp> = [styles.button];
const textStyles: Array<TextStyleProp> = [styles.text];
if (color) {
if (Boolean(color)) {
if (Platform.OS === 'ios') {
textStyles.push({color: color});
} else {
Expand All @@ -256,7 +256,7 @@ const Button: component(
? {..._accessibilityState, disabled}
: _accessibilityState;

if (disabled) {
if (disabled === true) {
buttonStyles.push(styles.buttonDisabled);
textStyles.push(styles.textDisabled);
}
Expand All @@ -279,7 +279,10 @@ const Button: component(
accessible={accessible}
accessibilityActions={accessibilityActions}
onAccessibilityAction={onAccessibilityAction}
accessibilityLabel={ariaLabel || accessibilityLabel}
accessibilityLabel={
// $FlowFixMe[sketchy-null-string]
ariaLabel || accessibilityLabel
}
accessibilityHint={accessibilityHint}
accessibilityLanguage={accessibilityLanguage}
accessibilityRole="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

// flowlint unsafe-getters-setters:off

import type {
MeasureInWindowOnSuccessCallback,
MeasureLayoutOnSuccessCallback,
Expand Down Expand Up @@ -204,7 +206,7 @@ class DrawerLayoutAndroid
);
}

setNativeProps(nativeProps: Object) {
setNativeProps(nativeProps: {...}) {
nullthrows(this._nativeRef.current).setNativeProps(nativeProps);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @flow strict-local
* @format
*/

Expand Down Expand Up @@ -127,7 +127,7 @@ export interface DrawerLayoutAndroidMethods {
onSuccess: MeasureLayoutOnSuccessCallback,
onFail?: () => void,
): void;
setNativeProps(nativeProps: Object): void;
setNativeProps(nativeProps: {...}): void;
}

export type DrawerLayoutAndroidInstance = DrawerLayoutAndroidMethods;
Loading
Loading