Skip to content

Commit

Permalink
Merge branch 'master' into feature/line-break-strategy-ios
Browse files Browse the repository at this point in the history
  • Loading branch information
bang9 authored Apr 20, 2021
2 parents 635d68b + 7258afe commit 4c58683
Show file tree
Hide file tree
Showing 455 changed files with 10,910 additions and 5,420 deletions.
2 changes: 1 addition & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ untyped-import
untyped-type-import

[version]
^0.147.0
^0.148.0
2 changes: 1 addition & 1 deletion .flowconfig.android
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ untyped-import
untyped-type-import

[version]
^0.147.0
^0.148.0
7 changes: 4 additions & 3 deletions IntegrationTests/AsyncStorageTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,10 @@ class AsyncStorageTest extends React.Component<{...}, $FlowFixMeState> {
return (
<View style={styles.container}>
<Text>
{/* $FlowFixMe(>=0.54.0 site=react_native_fb,react_native_oss) This
* comment suppresses an error found when Flow v0.54 was deployed.
* To see the error delete this comment and run Flow. */
{/* $FlowFixMe[incompatible-type] (>=0.54.0 site=react_native_fb,react_
* native_oss) This comment suppresses an error found when Flow v0.54
* was deployed. To see the error delete this comment and run Flow.
*/
this.constructor.displayName + ': '}
{this.state.done ? 'Done' : 'Testing...'}
{'\n\n' + this.state.messages}
Expand Down
7 changes: 4 additions & 3 deletions IntegrationTests/IntegrationTestHarnessTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ class IntegrationTestHarnessTest extends React.Component<Props, State> {
return (
<View style={styles.container}>
<Text>
{/* $FlowFixMe(>=0.54.0 site=react_native_fb,react_native_oss) This
* comment suppresses an error found when Flow v0.54 was deployed.
* To see the error delete this comment and run Flow. */
{/* $FlowFixMe[incompatible-type] (>=0.54.0 site=react_native_fb,react_
* native_oss) This comment suppresses an error found when Flow v0.54
* was deployed. To see the error delete this comment and run Flow.
*/
this.constructor.displayName + ': '}
{this.state.done ? 'Done' : 'Testing...'}
</Text>
Expand Down
20 changes: 11 additions & 9 deletions IntegrationTests/IntegrationTestsApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ const TESTS = [
];

TESTS.forEach(
/* $FlowFixMe(>=0.54.0 site=react_native_fb,react_native_oss) This comment
* suppresses an error found when Flow v0.54 was deployed. To see the error
* delete this comment and run Flow. */
/* $FlowFixMe[incompatible-call] (>=0.54.0 site=react_native_fb,react_native_
* oss) This comment suppresses an error found when Flow v0.54 was deployed.
* To see the error delete this comment and run Flow. */
test => AppRegistry.registerComponent(test.displayName, () => test),
);

Expand All @@ -60,9 +60,10 @@ class IntegrationTestsApp extends React.Component<{...}, $FlowFixMeState> {
if (this.state.test) {
return (
<ScrollView>
{/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This
* comment suppresses an error when upgrading Flow's support for
* React. To see the error delete this comment and run Flow. */}
{/* $FlowFixMe[type-as-value] (>=0.53.0 site=react_native_fb,react_
* native_oss) This comment suppresses an error when upgrading
* Flow's support for React. To see the error delete this comment
* and run Flow. */}
<this.state.test />
</ScrollView>
);
Expand All @@ -79,9 +80,10 @@ class IntegrationTestsApp extends React.Component<{...}, $FlowFixMeState> {
{TESTS.map(test => [
<TouchableOpacity
onPress={() => this.setState({test})}
/* $FlowFixMe(>=0.115.0 site=react_native_fb) This comment
* suppresses an error found when Flow v0.115 was deployed. To
* see the error, delete this comment and run Flow. */
/* $FlowFixMe[incompatible-type] (>=0.115.0 site=react_native_fb)
* This comment suppresses an error found when Flow v0.115 was
* deployed. To see the error, delete this comment and run Flow.
*/
style={styles.row}>
<Text style={styles.testName}>{test.displayName}</Text>
</TouchableOpacity>,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ActionSheetIOS/React-RCTActionSheet.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version = package['version']
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
source[:commit] = `git rev-parse HEAD`.strip
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
else
source[:tag] = "v#{version}"
end
Expand Down
6 changes: 3 additions & 3 deletions Libraries/Animated/AnimatedEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ class AnimatedEvent {
}
} else if (typeof recMapping === 'object') {
for (const mappingKey in recMapping) {
/* $FlowFixMe(>=0.120.0) This comment suppresses an error found
* when Flow v0.120 was deployed. To see the error, delete this
* comment and run Flow. */
/* $FlowFixMe[prop-missing] (>=0.120.0) This comment suppresses an
* error found when Flow v0.120 was deployed. To see the error,
* delete this comment and run Flow. */
traverse(recMapping[mappingKey], recEvt[mappingKey], mappingKey);
}
}
Expand Down
9 changes: 6 additions & 3 deletions Libraries/Animated/AnimatedWeb.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ const AnimatedImplementation = require('./AnimatedImplementation');

module.exports = {
...AnimatedImplementation,
// $FlowFixMe createAnimatedComponent expects to receive types. Plain intrinsic components can't be typed like this
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
* types. Plain intrinsic components can't be typed like this */
div: (AnimatedImplementation.createAnimatedComponent('div'): $FlowFixMe),
// $FlowFixMe createAnimatedComponent expects to receive types. Plain intrinsic components can't be typed like this
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
* types. Plain intrinsic components can't be typed like this */
span: (AnimatedImplementation.createAnimatedComponent('span'): $FlowFixMe),
// $FlowFixMe createAnimatedComponent expects to receive types. Plain intrinsic components can't be typed like this
/* $FlowFixMe[incompatible-call] createAnimatedComponent expects to receive
* types. Plain intrinsic components can't be typed like this */
img: (AnimatedImplementation.createAnimatedComponent('img'): $FlowFixMe),
};
9 changes: 7 additions & 2 deletions Libraries/Animated/NativeAnimatedHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,15 @@ module.exports = {
assertNativeAnimatedModule,
shouldUseNativeDriver,
transformDataType,
// $FlowExpectedError - unsafe getter lint suppresion
// $FlowExpectedError[unsafe-getters-setters] - unsafe getter lint suppresion
// $FlowExpectedError[missing-type-arg] - unsafe getter lint suppresion
get nativeEventEmitter(): NativeEventEmitter {
if (!nativeEventEmitter) {
nativeEventEmitter = new NativeEventEmitter(NativeAnimatedModule);
nativeEventEmitter = new NativeEventEmitter(
// T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior
// If you want to use the native module on other platforms, please remove this condition and test its behavior
Platform.OS !== 'ios' ? null : NativeAnimatedModule,
);
}
return nativeEventEmitter;
},
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Animated/components/AnimatedSectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import * as React from 'react';

const SectionList = require('../../Lists/SectionList');
import SectionList from '../../Lists/SectionList';
const createAnimatedComponent = require('../createAnimatedComponent');

import type {AnimatedComponentType} from '../createAnimatedComponent';
Expand Down
43 changes: 21 additions & 22 deletions Libraries/Animated/nodes/AnimatedInterpolation.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,23 +205,23 @@ function createInterpolationFromStringOutputRange(
// [200, 250],
// [0, 0.5],
// ]
/* $FlowFixMe(>=0.18.0): `outputRange[0].match()` can return `null`. Need to
* guard against this possibility.
*/
/* $FlowFixMe[incompatible-use] (>=0.18.0): `outputRange[0].match()` can
* return `null`. Need to guard against this possibility. */
const outputRanges = outputRange[0].match(stringShapeRegex).map(() => []);
outputRange.forEach(value => {
/* $FlowFixMe(>=0.18.0): `value.match()` can return `null`. Need to guard
* against this possibility.
*/
/* $FlowFixMe[incompatible-use] (>=0.18.0): `value.match()` can return
* `null`. Need to guard against this possibility. */
value.match(stringShapeRegex).forEach((number, i) => {
outputRanges[i].push(+number);
});
});

const interpolations = outputRange[0]
.match(stringShapeRegex)
/* $FlowFixMe(>=0.18.0): `outputRange[0].match()` can return `null`. Need
* to guard against this possibility. */
/* $FlowFixMe[incompatible-use] (>=0.18.0): `outputRange[0].match()` can
* return `null`. Need to guard against this possibility. */
/* $FlowFixMe[incompatible-call] (>=0.18.0): `outputRange[0].match()` can
* return `null`. Need to guard against this possibility. */
.map((value, i) => {
return createInterpolation({
...config,
Expand Down Expand Up @@ -277,12 +277,11 @@ function checkValidInputRange(arr: $ReadOnlyArray<number>) {
for (let i = 1; i < arr.length; ++i) {
invariant(
arr[i] >= arr[i - 1],
/* $FlowFixMe(>=0.13.0) - In the addition expression below this comment,
* one or both of the operands may be something that doesn't cleanly
* convert to a string, like undefined, null, and object, etc. If you really
* mean this implicit string conversion, you can do something like
* String(myThing)
*/
/* $FlowFixMe[incompatible-type] (>=0.13.0) - In the addition expression
* below this comment, one or both of the operands may be something that
* doesn't cleanly convert to a string, like undefined, null, and object,
* etc. If you really mean this implicit string conversion, you can do
* something like String(myThing) */
'inputRange must be monotonically non-decreasing ' + arr,
);
}
Expand All @@ -292,12 +291,11 @@ function checkInfiniteRange(name: string, arr: $ReadOnlyArray<number>) {
invariant(arr.length >= 2, name + ' must have at least 2 elements');
invariant(
arr.length !== 2 || arr[0] !== -Infinity || arr[1] !== Infinity,
/* $FlowFixMe(>=0.13.0) - In the addition expression below this comment,
* one or both of the operands may be something that doesn't cleanly convert
* to a string, like undefined, null, and object, etc. If you really mean
* this implicit string conversion, you can do something like
* String(myThing)
*/
/* $FlowFixMe[incompatible-type] (>=0.13.0) - In the addition expression
* below this comment, one or both of the operands may be something that
* doesn't cleanly convert to a string, like undefined, null, and object,
* etc. If you really mean this implicit string conversion, you can do
* something like String(myThing) */
name + 'cannot be ]-infinity;+infinity[ ' + arr,
);
}
Expand Down Expand Up @@ -358,8 +356,9 @@ class AnimatedInterpolation extends AnimatedWithChildren {
return {
inputRange: this._config.inputRange,
// Only the `outputRange` can contain strings so we don't need to transform `inputRange` here
/* $FlowFixMe(>=0.38.0) - Flow error detected during the deployment of
* v0.38.0. To see the error, remove this comment and run flow */
/* $FlowFixMe[incompatible-call] (>=0.38.0) - Flow error detected during
* the deployment of v0.38.0. To see the error, remove this comment and
* run flow */
outputRange: this.__transformDataType(this._config.outputRange),
extrapolateLeft:
this._config.extrapolateLeft || this._config.extrapolate || 'extend',
Expand Down
8 changes: 4 additions & 4 deletions Libraries/Animated/nodes/AnimatedValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ const NativeAnimatedAPI = NativeAnimatedHelper.API;
function _flush(rootNode: AnimatedValue): void {
const animatedStyles = new Set();
function findAnimatedStyles(node) {
/* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.68 was deployed. To see the error delete this
* comment and run Flow. */
/* $FlowFixMe[prop-missing] (>=0.68.0 site=react_native_fb) This comment
* suppresses an error found when Flow v0.68 was deployed. To see the error
* delete this comment and run Flow. */
if (typeof node.update === 'function') {
animatedStyles.add(node);
} else {
node.__getChildren().forEach(findAnimatedStyles);
}
}
findAnimatedStyles(rootNode);
/* $FlowFixMe */
// $FlowFixMe[prop-missing]
animatedStyles.forEach(animatedStyle => animatedStyle.update());
}

Expand Down
6 changes: 4 additions & 2 deletions Libraries/AppState/AppState.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {type EventSubscription} from '../vendor/emitter/EventEmitter';
import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
import logError from '../Utilities/logError';
import NativeAppState from './NativeAppState';
import Platform from '../Utilities/Platform';

export type AppStateValues = 'inactive' | 'background' | 'active';

Expand Down Expand Up @@ -47,7 +48,9 @@ class AppState {
this.isAvailable = true;

const emitter: NativeEventEmitter<NativeAppStateEventDefinitions> = new NativeEventEmitter(
NativeAppState,
// T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior
// If you want to use the native module on other platforms, please remove this condition and test its behavior
Platform.OS !== 'ios' ? null : NativeAppState,
);
this._emitter = emitter;

Expand Down Expand Up @@ -144,7 +147,6 @@ class AppState {
return;
case 'memoryWarning':
// $FlowIssue[invalid-tuple-arity] Flow cannot refine handler based on the event type
// $FlowIssue[incompatible-call]
emitter.removeListener('memoryWarning', listener);
return;
case 'blur':
Expand Down
46 changes: 7 additions & 39 deletions Libraries/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,22 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

load("//tools/build_defs:fb_native_wrapper.bzl", "fb_native")
load(
"//tools/build_defs/oss:rn_codegen_defs.bzl",
"rn_codegen_components",
"rn_codegen_modules",
)
load(
"//tools/build_defs/oss:rn_defs.bzl",
"react_native_root_target",
)

fb_native.genrule(
# The schema name must have the following format: "{name}-codegen-modules-schema"
# Why: Internally, we have build scripts that find all NativeModule schemas in the
# dependencies of an app, and build TurboModuleManager delegates. Those scripts assume
# that all schema targets have the aforementioned naming scheme.
name = "FBReactNativeSpec-codegen-modules-schema",
srcs = glob(
[
"**/*.js",
],
exclude = [
"**/__tests__/**/*",
],
),
cmd = "$(exe {}) $OUT $SRCS".format(react_native_root_target("packages/react-native-codegen:write_to_json")),
out = "schema.json",
labels = [
"codegen_rule",
"react_native_schema_target",
],
"rn_codegen",
)

rn_codegen_modules(
rn_codegen(
name = "FBReactNativeSpec",
android_package_name = "com.facebook.fbreact.specs",
codegen_modules = True,
library_labels = ["supermodule:xplat/default/public.react_native.infra"],
schema_target = ":FBReactNativeSpec-codegen-modules-schema",
native_module_spec_name = "FBReactNativeSpec",
)

rn_codegen_components(
# TODO: Merge this into FBReactNativeSpec
rn_codegen(
name = "FBReactNativeComponentSpec",
codegen_components = True,
library_labels = ["supermodule:xplat/default/public.react_native.infra"],
# Why does FBReactNativeComponentSpec depend on -codegen-modules-schema?
# The module codegen schema also contains components. We cannot change the name
# of the schema target, because internally, we have infra that depends on how
# it's named.
#
# TODO(T83341482): Clean up how OSS NativeModule codegen is declared
schema_target = ":FBReactNativeSpec-codegen-modules-schema",
)
2 changes: 1 addition & 1 deletion Libraries/BatchedBridge/MessageQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ class MessageQueue {
// can be configured by the VM or any Inspector
__shouldPauseOnThrow(): boolean {
return (
// $FlowFixMe
// $FlowFixMe[cannot-resolve-name]
typeof DebuggerInternal !== 'undefined' &&
DebuggerInternal.shouldPauseOnThrow === true // eslint-disable-line no-undef
);
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Blob/React-RCTBlob.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version = package['version']
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
source[:commit] = `git rev-parse HEAD`.strip
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
else
source[:tag] = "v#{version}"
end
Expand Down
2 changes: 1 addition & 1 deletion Libraries/BugReporting/getReactData.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function copyWithSetImpl(obj, path, idx, value) {
}
const key = path[idx];
const updated = Array.isArray(obj) ? obj.slice() : {...obj};
// $FlowFixMe number or string is fine here
// $FlowFixMe[incompatible-use] number or string is fine here
updated[key] = copyWithSetImpl(obj[key], path, idx + 1, value);
return updated;
}
Expand Down
Loading

0 comments on commit 4c58683

Please sign in to comment.