mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Suppress errors ahead of launch
Summary:
Ahead of enabling the `exact_empty_objects` option, suppress errors so that actually enabling the option is easier. We can do this without enabling the option by codemoding `{}` to `{...null}` in files that have errors.
Process:
1) Get list of files with errors when enabling the option
2) Codemod `{}` to `{...null}` in those files
3) Suppress resulting errors
4) Land diff with `drop-conflicts` flag
5) Announce and enable option (with many fewer files to edit)
6) Codemod all `{...null}` to `{}`
drop-conflicts
We are working on making the empty object literal `{}` have the type `{}` - i.e. exact empty object - rather than being unsealed.
More info in these posts: https://fb.workplace.com/groups/flowlang/posts/903386663600331, https://fb.workplace.com/groups/floweng/posts/8626146484100557
Reviewed By: pieterv
Differential Revision: D37731004
fbshipit-source-id: a9305859ba4e8adbdb8ae8feff3ec8a2f07ed236
This commit is contained in:
committed by
Facebook GitHub Bot
parent
bb460468a4
commit
67e12a19cb
@@ -369,7 +369,9 @@ const parallel = function (
|
||||
): CompositeAnimation {
|
||||
let doneCount = 0;
|
||||
// Make sure we only call stop() at most once for each animation
|
||||
const hasEnded = {};
|
||||
const hasEnded = {
|
||||
...null,
|
||||
};
|
||||
const stopTogether = !(config && config.stopTogether === false);
|
||||
|
||||
const result = {
|
||||
@@ -460,7 +462,10 @@ type LoopAnimationConfig = {
|
||||
|
||||
const loop = function (
|
||||
animation: CompositeAnimation,
|
||||
{iterations = -1, resetBeforeIteration = true}: LoopAnimationConfig = {},
|
||||
// $FlowFixMe[prop-missing]
|
||||
{iterations = -1, resetBeforeIteration = true}: LoopAnimationConfig = {
|
||||
...null,
|
||||
},
|
||||
): CompositeAnimation {
|
||||
let isFinished = false;
|
||||
let iterationsSoFar = 0;
|
||||
|
||||
@@ -160,7 +160,10 @@ type LoopAnimationConfig = {
|
||||
|
||||
const loop = function (
|
||||
animation: CompositeAnimation,
|
||||
{iterations = -1}: LoopAnimationConfig = {},
|
||||
// $FlowFixMe[prop-missing]
|
||||
{iterations = -1}: LoopAnimationConfig = {
|
||||
...null,
|
||||
},
|
||||
): CompositeAnimation {
|
||||
return emptyAnimation;
|
||||
};
|
||||
|
||||
@@ -48,8 +48,12 @@ const useSingleOpBatching =
|
||||
ReactNativeFeatureFlags.animatedShouldUseSingleOp();
|
||||
let flushQueueTimeout = null;
|
||||
|
||||
const eventListenerGetValueCallbacks = {};
|
||||
const eventListenerAnimationFinishedCallbacks = {};
|
||||
const eventListenerGetValueCallbacks = {
|
||||
...null,
|
||||
};
|
||||
const eventListenerAnimationFinishedCallbacks = {
|
||||
...null,
|
||||
};
|
||||
let globalEventEmitterGetValueListener: ?EventSubscription = null;
|
||||
let globalEventEmitterAnimationFinishedListener: ?EventSubscription = null;
|
||||
|
||||
@@ -78,11 +82,17 @@ const nativeOps: ?typeof NativeAnimatedModule = useSingleOpBatching
|
||||
'addListener', // 20
|
||||
'removeListener', // 21
|
||||
];
|
||||
return apis.reduce((acc, functionName, i) => {
|
||||
// These indices need to be kept in sync with the indices in native (see NativeAnimatedModule in Java, or the equivalent for any other native platform).
|
||||
acc[functionName] = i + 1;
|
||||
return acc;
|
||||
}, {});
|
||||
return apis.reduce(
|
||||
(acc, functionName, i) => {
|
||||
// These indices need to be kept in sync with the indices in native (see NativeAnimatedModule in Java, or the equivalent for any other native platform).
|
||||
// $FlowFixMe[prop-missing]
|
||||
acc[functionName] = i + 1;
|
||||
return acc;
|
||||
},
|
||||
{
|
||||
...null,
|
||||
},
|
||||
);
|
||||
})(): $FlowFixMe)
|
||||
: NativeAnimatedModule;
|
||||
|
||||
|
||||
@@ -30,7 +30,10 @@ const BOBBLE_SPOTS = [...Array(NUM_BOBBLES)].map((_, i) => {
|
||||
class AnExBobble extends React.Component<Object, any> {
|
||||
constructor(props: Object) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
this.state = {
|
||||
...null,
|
||||
};
|
||||
// $FlowFixMe[prop-missing]
|
||||
this.state.bobbles = BOBBLE_SPOTS.map((_, i) => {
|
||||
return new Animated.ValueXY();
|
||||
});
|
||||
@@ -98,7 +101,12 @@ class AnExBobble extends React.Component<Object, any> {
|
||||
<View style={styles.bobbleContainer}>
|
||||
{this.state.bobbles.map((_, i) => {
|
||||
const j = this.state.bobbles.length - i - 1; // reverse so lead on top
|
||||
const handlers = j > 0 ? {} : this.state.bobbleResponder.panHandlers;
|
||||
const handlers =
|
||||
j > 0
|
||||
? {
|
||||
...null,
|
||||
}
|
||||
: this.state.bobbleResponder.panHandlers;
|
||||
return (
|
||||
<Animated.Image
|
||||
{...handlers}
|
||||
|
||||
Reference in New Issue
Block a user