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
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,46 +4,47 @@
* 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
*/

import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
import type {UnsafeObject} from '../../../../Libraries/Types/CodegenTypes';

import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';

export interface Spec extends TurboModule {
readonly getCurrentBoldTextState: (
onSuccess: (isBoldTextEnabled: boolean) => void,
onError: (error: Object) => void,
onError: (error: UnsafeObject) => void,
) => void;
readonly getCurrentGrayscaleState: (
onSuccess: (isGrayscaleEnabled: boolean) => void,
onError: (error: Object) => void,
onError: (error: UnsafeObject) => void,
) => void;
readonly getCurrentInvertColorsState: (
onSuccess: (isInvertColorsEnabled: boolean) => void,
onError: (error: Object) => void,
onError: (error: UnsafeObject) => void,
) => void;
readonly getCurrentReduceMotionState: (
onSuccess: (isReduceMotionEnabled: boolean) => void,
onError: (error: Object) => void,
onError: (error: UnsafeObject) => void,
) => void;
readonly getCurrentDarkerSystemColorsState?: (
onSuccess: (isDarkerSystemColorsEnabled: boolean) => void,
onError: (error: Object) => void,
onError: (error: UnsafeObject) => void,
) => void;
readonly getCurrentPrefersCrossFadeTransitionsState?: (
onSuccess: (prefersCrossFadeTransitions: boolean) => void,
onError: (error: Object) => void,
onError: (error: UnsafeObject) => void,
) => void;
readonly getCurrentReduceTransparencyState: (
onSuccess: (isReduceTransparencyEnabled: boolean) => void,
onError: (error: Object) => void,
onError: (error: UnsafeObject) => void,
) => void;
readonly getCurrentVoiceOverState: (
onSuccess: (isScreenReaderEnabled: boolean) => void,
onError: (error: Object) => void,
onError: (error: UnsafeObject) => void,
) => void;
readonly setAccessibilityContentSizeMultipliers: (JSMultipliers: {
readonly extraSmall?: ?number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +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
*/

import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
import type {UnsafeObject} from '../../../../Libraries/Types/CodegenTypes';

import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';

Expand Down Expand Up @@ -45,7 +46,7 @@ export interface Spec extends TurboModule {
failureCallback: (error: {
readonly domain: string,
readonly code: string,
readonly userInfo?: ?Object,
readonly userInfo?: ?UnsafeObject,
readonly message: string,
}) => void,
successCallback: (completed: boolean, activityType: ?string) => void,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
* 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
*/

import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
import type {UnsafeObject} from '../../../../Libraries/Types/CodegenTypes';

import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';

export type Args = {
title?: string,
message?: string,
buttons?: Array<Object>, // TODO(T67565166): have a better type
buttons?: Array<UnsafeObject>, // TODO(T67565166): have a better type
type?: string,
defaultValue?: string,
cancelButtonKey?: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +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
*/

import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
import type {UnsafeObject} from '../../../../Libraries/Types/CodegenTypes';

import shouldUseTurboAnimatedModule from '../../../../Libraries/Animated/shouldUseTurboAnimatedModule';
import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
Expand All @@ -24,8 +25,8 @@ export type EventMapping = {

// The config has different keys depending on the type of the Node
// TODO(T54896888): Make these types strict
export type AnimatedNodeConfig = Object;
export type AnimatingNodeConfig = Object;
export type AnimatedNodeConfig = UnsafeObject;
export type AnimatingNodeConfig = UnsafeObject;

export interface Spec extends TurboModule {
readonly startOperationBatch: () => void;
Expand Down Expand Up @@ -66,7 +67,7 @@ export interface Spec extends TurboModule {
) => void;
readonly connectAnimatedNodeToShadowNodeFamily?: (
nodeTag: number,
shadowNode: Object,
shadowNode: UnsafeObject,
) => void;
readonly disconnectAnimatedNodeFromView: (
nodeTag: number,
Expand All @@ -91,7 +92,7 @@ export interface Spec extends TurboModule {

// All of the above in a batched mode
readonly queueAndExecuteBatchedOperations?: (
operationsAndArgs: Array<any>,
operationsAndArgs: Array<unknown>,
) => void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +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
*/

import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
import type {UnsafeObject} from '../../../../Libraries/Types/CodegenTypes';

import shouldUseTurboAnimatedModule from '../../../../Libraries/Animated/shouldUseTurboAnimatedModule';
import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';
Expand All @@ -24,8 +25,8 @@ export type EventMapping = {

// The config has different keys depending on the type of the Node
// TODO(T54896888): Make these types strict
export type AnimatedNodeConfig = Object;
export type AnimatingNodeConfig = Object;
export type AnimatedNodeConfig = UnsafeObject;
export type AnimatingNodeConfig = UnsafeObject;

export interface Spec extends TurboModule {
readonly startOperationBatch: () => void;
Expand Down Expand Up @@ -87,7 +88,7 @@ export interface Spec extends TurboModule {

// All of the above in a batched mode
readonly queueAndExecuteBatchedOperations?: (
operationsAndArgs: Array<any>,
operationsAndArgs: Array<unknown>,
) => void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +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
*/

import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
import type {UnsafeObject} from '../../../../Libraries/Types/CodegenTypes';

import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';

Expand All @@ -22,7 +23,7 @@ export interface Spec extends TurboModule {
readonly getConstants: () => AppStateConstants;
readonly getCurrentAppState: (
success: (appState: AppState) => void,
error: (error: Object) => void,
error: (error: UnsafeObject) => void,
) => void;

// Events
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +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
*/

import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
import type {UnsafeObject} from '../../../../Libraries/Types/CodegenTypes';

import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';

Expand All @@ -19,8 +20,11 @@ export interface Spec extends TurboModule {
readonly addNetworkingHandler: () => void;
readonly addWebSocketHandler: (id: number) => void;
readonly removeWebSocketHandler: (id: number) => void;
readonly sendOverSocket: (blob: Object, socketID: number) => void;
readonly createFromParts: (parts: Array<Object>, withId: string) => void;
readonly sendOverSocket: (blob: UnsafeObject, socketID: number) => void;
readonly createFromParts: (
parts: Array<UnsafeObject>,
withId: string,
) => void;
readonly release: (blobId: string) => void;
}

Expand All @@ -46,10 +50,10 @@ if (NativeModule != null) {
removeWebSocketHandler(id: number): void {
NativeModule.removeWebSocketHandler(id);
},
sendOverSocket(blob: Object, socketID: number): void {
sendOverSocket(blob: UnsafeObject, socketID: number): void {
NativeModule.sendOverSocket(blob, socketID);
},
createFromParts(parts: Array<Object>, withId: string): void {
createFromParts(parts: Array<UnsafeObject>, withId: string): void {
NativeModule.createFromParts(parts, withId);
},
release(blobId: string): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
* 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
*/

import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
import type {UnsafeObject} from '../../../../Libraries/Types/CodegenTypes';

import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';

export interface Spec extends TurboModule {
readonly readAsDataURL: (data: Object) => Promise<string>;
readonly readAsText: (data: Object, encoding: string) => Promise<string>;
readonly readAsDataURL: (data: UnsafeObject) => Promise<string>;
readonly readAsText: (
data: UnsafeObject,
encoding: string,
) => Promise<string>;
}

export default TurboModuleRegistry.getEnforcing<Spec>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +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
*/

import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport';
import type {UnsafeObject} from '../../../../Libraries/Types/CodegenTypes';

import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry';

Expand All @@ -24,10 +25,10 @@ export interface Spec extends TurboModule {
readonly getSize: (uri: string) => Promise<ImageSize>;
readonly getSizeWithHeaders: (
uri: string,
headers: Object,
headers: UnsafeObject,
) => Promise<ImageSize>;
readonly prefetchImage: (uri: string, requestId: number) => Promise<boolean>;
readonly queryCache: (uris: Array<string>) => Promise<Object>;
readonly queryCache: (uris: Array<string>) => Promise<UnsafeObject>;
}

export default TurboModuleRegistry.getEnforcing<Spec>('ImageLoader') as Spec;
Loading
Loading