Skip to content
Merged
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
8 changes: 6 additions & 2 deletions packages/react-native/Libraries/Animated/AnimatedExports.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @format
*/

// flowlint unsafe-getters-setters:off

import typeof AnimatedFlatList from './components/AnimatedFlatList';
import typeof AnimatedImage from './components/AnimatedImage';
import typeof AnimatedScrollView from './components/AnimatedScrollView';
Expand All @@ -29,36 +27,42 @@ export default {
/**
* @deprecated Use `AnimatedFlatList` instead.
*/
// $FlowFixMe[unsafe-getters-setters]
get FlatList(): AnimatedFlatList<> {
return require('./components/AnimatedFlatList').default;
},
/**
* @deprecated Use `AnimatedImage` instead.
*/
// $FlowFixMe[unsafe-getters-setters]
get Image(): AnimatedImage {
return require('./components/AnimatedImage').default;
},
/**
* @deprecated Use `AnimatedScrollView` instead.
*/
// $FlowFixMe[unsafe-getters-setters]
get ScrollView(): AnimatedScrollView {
return require('./components/AnimatedScrollView').default;
},
/**
* @deprecated Use `AnimatedSectionList` instead.
*/
// $FlowFixMe[unsafe-getters-setters]
get SectionList(): AnimatedSectionList<> {
return require('./components/AnimatedSectionList').default;
},
/**
* @deprecated Use `AnimatedText` instead.
*/
// $FlowFixMe[unsafe-getters-setters]
get Text(): AnimatedText {
return require('./components/AnimatedText').default;
},
/**
* @deprecated Use `AnimatedView` instead.
*/
// $FlowFixMe[unsafe-getters-setters]
get View(): AnimatedView {
return require('./components/AnimatedView').default;
},
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/Libraries/Blob/File.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @format
*/

// flowlint unsafe-getters-setters:off

'use strict';

import type {BlobOptions} from './BlobTypes';
Expand Down Expand Up @@ -42,6 +40,7 @@ class File extends Blob {
/**
* Name of the file.
*/
// $FlowFixMe[unsafe-getters-setters]
get name(): string {
invariant(this.data.name != null, 'Files must have a name set.');
return this.data.name;
Expand All @@ -50,6 +49,7 @@ class File extends Blob {
/*
* Last modified time of the file.
*/
// $FlowFixMe[unsafe-getters-setters]
get lastModified(): number {
return this.data.lastModified || 0;
}
Expand Down
17 changes: 15 additions & 2 deletions packages/react-native/Libraries/Blob/FileReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @format
*/

// flowlint unsafe-getters-setters:off

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

Expand Down Expand Up @@ -227,62 +225,77 @@ class FileReader extends EventTarget {
}
}

// $FlowFixMe[unsafe-getters-setters]
get readyState(): ReadyState {
return this._readyState;
}

// $FlowFixMe[unsafe-getters-setters]
get error(): ?DOMException {
return this._error;
}

// $FlowFixMe[unsafe-getters-setters]
get result(): ?ReaderResult {
return this._result;
}

// $FlowFixMe[unsafe-getters-setters]
get onabort(): EventCallback | null {
return getEventHandlerAttribute(this, 'abort');
}

// $FlowFixMe[unsafe-getters-setters]
set onabort(listener: ?EventCallback) {
setEventHandlerAttribute(this, 'abort', listener);
}

// $FlowFixMe[unsafe-getters-setters]
get onerror(): EventCallback | null {
return getEventHandlerAttribute(this, 'error');
}

// $FlowFixMe[unsafe-getters-setters]
set onerror(listener: ?EventCallback) {
setEventHandlerAttribute(this, 'error', listener);
}

// $FlowFixMe[unsafe-getters-setters]
get onload(): EventCallback | null {
return getEventHandlerAttribute(this, 'load');
}

// $FlowFixMe[unsafe-getters-setters]
set onload(listener: ?EventCallback) {
setEventHandlerAttribute(this, 'load', listener);
}

// $FlowFixMe[unsafe-getters-setters]
get onloadstart(): EventCallback | null {
return getEventHandlerAttribute(this, 'loadstart');
}

// $FlowFixMe[unsafe-getters-setters]
set onloadstart(listener: ?EventCallback) {
setEventHandlerAttribute(this, 'loadstart', listener);
}

// $FlowFixMe[unsafe-getters-setters]
get onloadend(): EventCallback | null {
return getEventHandlerAttribute(this, 'loadend');
}

// $FlowFixMe[unsafe-getters-setters]
set onloadend(listener: ?EventCallback) {
setEventHandlerAttribute(this, 'loadend', listener);
}

// $FlowFixMe[unsafe-getters-setters]
get onprogress(): EventCallback | null {
return getEventHandlerAttribute(this, 'progress');
}

// $FlowFixMe[unsafe-getters-setters]
set onprogress(listener: ?EventCallback) {
setEventHandlerAttribute(this, 'progress', listener);
}
Expand Down
15 changes: 13 additions & 2 deletions packages/react-native/Libraries/Blob/URL.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @format
*/

// flowlint unsafe-getters-setters:off

import type Blob from './Blob';

import NativeBlobModule from './NativeBlobModule';
Expand Down Expand Up @@ -125,11 +123,13 @@ export class URL {
}
}

// $FlowFixMe[unsafe-getters-setters]
get hash(): string {
const hashMatch = this._url.match(/#([^/]*)/);
return hashMatch ? `#${hashMatch[1]}` : '';
}

// $FlowFixMe[unsafe-getters-setters]
get host(): string {
const hostMatch = this._url.match(/^https?:\/\/(?:[^@]+@)?([^:/?#]+)/);
const portMatch = this._url.match(/:(\d+)(?=[/?#]|$)/);
Expand All @@ -138,45 +138,54 @@ export class URL {
: '';
}

// $FlowFixMe[unsafe-getters-setters]
get hostname(): string {
const hostnameMatch = this._url.match(/^https?:\/\/(?:[^@]+@)?([^:/?#]+)/);
return hostnameMatch ? hostnameMatch[1] : '';
}

// $FlowFixMe[unsafe-getters-setters]
get href(): string {
return this.toString();
}

// $FlowFixMe[unsafe-getters-setters]
get origin(): string {
const matches = this._url.match(/^(https?:\/\/[^/]+)/);
return matches ? matches[1] : '';
}

// $FlowFixMe[unsafe-getters-setters]
get password(): string {
const passwordMatch = this._url.match(/https?:\/\/.*:(.*)@/);
return passwordMatch ? passwordMatch[1] : '';
}

// $FlowFixMe[unsafe-getters-setters]
get pathname(): string {
const pathMatch = this._url.match(/https?:\/\/[^/]+(\/[^?#]*)?/);
return pathMatch ? pathMatch[1] || '/' : '/';
}

// $FlowFixMe[unsafe-getters-setters]
get port(): string {
const portMatch = this._url.match(/:(\d+)(?=[/?#]|$)/);
return portMatch ? portMatch[1] : '';
}

// $FlowFixMe[unsafe-getters-setters]
get protocol(): string {
const protocolMatch = this._url.match(/^([a-zA-Z][a-zA-Z\d+\-.]*):/);
return protocolMatch ? protocolMatch[1] + ':' : '';
}

// $FlowFixMe[unsafe-getters-setters]
get search(): string {
const searchMatch = this._url.match(/\?([^#]*)/);
return searchMatch ? `?${searchMatch[1]}` : '';
}

// $FlowFixMe[unsafe-getters-setters]
set search(value: string) {
// Remove leading '?' if present
const searchString = value.startsWith('?') ? value.slice(1) : value;
Expand All @@ -195,6 +204,7 @@ export class URL {
this._searchParamsInstance = null;
}

// $FlowFixMe[unsafe-getters-setters]
get searchParams(): URLSearchParams {
if (this._searchParamsInstance == null) {
this._searchParamsInstance = new URLSearchParams(this.search);
Expand Down Expand Up @@ -225,6 +235,7 @@ export class URL {
}
}

// $FlowFixMe[unsafe-getters-setters]
get username(): string {
const usernameMatch = this._url.match(/^https?:\/\/([^:@]+)(?::[^@]*)?@/);
return usernameMatch ? usernameMatch[1] : '';
Expand Down
3 changes: 1 addition & 2 deletions packages/react-native/Libraries/Blob/URLSearchParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
* @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 {
_searchParams: Map<string, string[]> = new Map();

// $FlowFixMe[unsafe-getters-setters]
get size(): number {
return this._searchParams.size;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @format
*/

// flowlint unsafe-getters-setters:off

import type {
MeasureInWindowOnSuccessCallback,
MeasureLayoutOnSuccessCallback,
Expand Down Expand Up @@ -48,6 +46,7 @@ class DrawerLayoutAndroid
extends React.Component<DrawerLayoutAndroidProps, DrawerLayoutAndroidState>
implements DrawerLayoutAndroidMethods
{
// $FlowFixMe[unsafe-getters-setters]
static get positions(): unknown {
console.warn(
'Setting DrawerLayoutAndroid drawerPosition using `DrawerLayoutAndroid.positions` is deprecated. Instead pass the string value "left" or "right"',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,5 +731,5 @@ let AndroidTextInputNativeComponent =
() => __INTERNAL_VIEW_CONFIG,
);

// flowlint-next-line unclear-type:off
// $FlowFixMe[unclear-type]
export default AndroidTextInputNativeComponent as any as HostComponent<AndroidTextInputNativeProps>;
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ const MultilineTextInputNativeComponent: HostComponent<{...}> =
() => __INTERNAL_VIEW_CONFIG,
);

// flowlint-next-line unclear-type:off
// $FlowFixMe[unclear-type]
export default MultilineTextInputNativeComponent as any as HostComponent<{...}>;
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const SinglelineTextInputNativeComponent: HostComponent<{...}> =
() => __INTERNAL_VIEW_CONFIG,
);

// flowlint-next-line unclear-type:off
// $FlowFixMe[unclear-type]
export default SinglelineTextInputNativeComponent as any as HostComponent<{
...
}>;
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ if (!hasNativeGenerator) {

// regenerator-runtime/runtime exports the regeneratorRuntime object, so we
// can return it safely.
return require('regenerator-runtime/runtime'); // flowlint-line untyped-import:off
// $FlowFixMe[untyped-import]
return require('regenerator-runtime/runtime');
});
}
3 changes: 2 additions & 1 deletion packages/react-native/Libraries/Core/setUpSegmentFetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ function __fetchSegment(
) => {
if (errorObject) {
const error = new Error(errorObject.message);
(error as any).code = errorObject.code; // flowlint-line unclear-type: off
// $FlowFixMe[unclear-type]
(error as any).code = errorObject.code;
callback(error);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/Libraries/Lists/FlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ export type FlatListProps<ItemT> = Readonly<{
*
* Also inherits [ScrollView Props](docs/scrollview.html#props), unless it is nested in another FlatList of same orientation.
*/
// flowlint-next-line unclear-type:off
// $FlowFixMe[unclear-type]
class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
/**
* Scrolls to the end of the content. May be janky without `getItemLayout` prop.
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/Libraries/Lists/SectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import * as React from 'react';
const VirtualizedSectionList = VirtualizedLists.VirtualizedSectionList;

type DefaultSectionT = {
// flowlint-next-line unclear-type:off
// $FlowFixMe[unclear-type]
[key: string]: any,
};

Expand Down Expand Up @@ -173,7 +173,7 @@ export type SectionListProps<ItemT, SectionT = DefaultSectionT> = {
* @see https://reactnative.dev/docs/sectionlist
*/
export default class SectionList<
// flowlint-next-line unclear-type:off
// $FlowFixMe[unclear-type]
ItemT = any,
SectionT = DefaultSectionT,
> extends React.PureComponent<SectionListProps<ItemT, SectionT>> {
Expand Down
Loading
Loading