Skip to content

Commit 3dad2ac

Browse files
authored
Merge pull request #816 from amgleitman/amgleitman/0.64-merge-2020-06-30
Merge from upstream through 2020-06-30
2 parents 70287d1 + ad641ca commit 3dad2ac

File tree

293 files changed

+6522
-3443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

293 files changed

+6522
-3443
lines changed

.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ untyped-import
8686
untyped-type-import
8787

8888
[version]
89-
^0.126.1
89+
^0.127.0

.flowconfig.android

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ untyped-import
8989
untyped-type-import
9090

9191
[version]
92-
^0.126.1
92+
^0.127.0

.flowconfig.macos

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ suppress_type=$FlowFixMeProps
5959
suppress_type=$FlowFixMeState
6060
suppress_type=$FlowFixMeEmpty
6161

62-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_macos\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
63-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_macos\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
64-
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
65-
6662
experimental.well_formed_exports=true
6763
experimental.types_first=true
6864
experimental.abstract_locations=true
@@ -89,4 +85,4 @@ untyped-import
8985
untyped-type-import
9086

9187
[version]
92-
^0.126.1
88+
^0.127.0

IntegrationTests/AccessibilityManagerTest.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010

1111
'use strict';
1212

13-
const React = require('react');
14-
const ReactNative = require('react-native');
15-
const {View} = ReactNative;
16-
const RCTDeviceEventEmitter = require('react-native/Libraries/EventEmitter/RCTDeviceEventEmitter');
17-
const {TestModule} = ReactNative.NativeModules;
18-
import NativeAccessibilityManager from 'react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager';
1913
import invariant from 'invariant';
14+
import NativeAccessibilityManager from 'react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager';
15+
import {DeviceEventEmitter, NativeModules, View} from 'react-native';
16+
import * as React from 'react';
17+
18+
const {TestModule} = NativeModules;
2019

2120
class AccessibilityManagerTest extends React.Component<{...}> {
2221
componentDidMount() {
@@ -39,7 +38,7 @@ class AccessibilityManagerTest extends React.Component<{...}> {
3938
accessibilityExtraExtraLarge: 11.0,
4039
accessibilityExtraExtraExtraLarge: 12.0,
4140
});
42-
RCTDeviceEventEmitter.addListener('didUpdateDimensions', update => {
41+
DeviceEventEmitter.addListener('didUpdateDimensions', update => {
4342
TestModule.markTestPassed(update.window.fontScale === 4.0);
4443
});
4544
}

IntegrationTests/ReactContentSizeUpdateTest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const ReactNative = require('react-native');
1717
const {View} = ReactNative;
1818

1919
const {TestModule} = ReactNative.NativeModules;
20-
import type EmitterSubscription from 'react-native/Libraries/vendor/emitter/EmitterSubscription';
20+
import {type EventSubscription} from 'react-native/Libraries/vendor/emitter/EventEmitter';
2121

2222
const reactViewWidth = 101;
2323
const reactViewHeight = 102;
@@ -33,7 +33,7 @@ type State = {|
3333

3434
class ReactContentSizeUpdateTest extends React.Component<Props, State> {
3535
_timeoutID: ?TimeoutID = null;
36-
_subscription: ?EmitterSubscription = null;
36+
_subscription: ?EventSubscription = null;
3737

3838
state: State = {
3939
height: reactViewHeight,

IntegrationTests/SizeFlexibilityUpdateTest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const ReactNative = require('react-native');
1616
const {View} = ReactNative;
1717

1818
const {TestModule} = ReactNative.NativeModules;
19-
import type EmitterSubscription from 'react-native/Libraries/vendor/emitter/EmitterSubscription';
19+
import {type EventSubscription} from 'react-native/Libraries/vendor/emitter/EventEmitter';
2020

2121
const reactViewWidth = 111;
2222
const reactViewHeight = 222;
@@ -31,7 +31,7 @@ type Props = $ReadOnly<{|
3131
|}>;
3232

3333
class SizeFlexibilityUpdateTest extends React.Component<Props> {
34-
_subscription: ?EmitterSubscription = null;
34+
_subscription: ?EventSubscription = null;
3535

3636
UNSAFE_componentWillMount() {
3737
this._subscription = RCTNativeAppEventEmitter.addListener(

Libraries/Alert/NativeAlertManager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type {DefaultInputsArray} from './AlertMacOS'; // TODO(macOS GH#774)
1717
export type Args = {|
1818
title?: string,
1919
message?: string,
20-
buttons?: Array<Object>, // TODO: have a better type
20+
buttons?: Array<Object>, // TODO(T67565166): have a better type
2121
type?: string,
2222
defaultValue?: string,
2323
cancelButtonKey?: string,

Libraries/Animated/src/NativeAnimatedHelper.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ const API = {
3838
enableQueue: function(): void {
3939
queueConnections = true;
4040
},
41+
getValue: function(
42+
tag: number,
43+
saveValueCallback: (value: number) => void,
44+
): void {
45+
invariant(NativeAnimatedModule, 'Native animated module is not available');
46+
if (NativeAnimatedModule.getValue) {
47+
NativeAnimatedModule.getValue(tag, saveValueCallback);
48+
}
49+
},
4150
disableQueue: function(): void {
4251
invariant(NativeAnimatedModule, 'Native animated module is not available');
4352
queueConnections = false;

Libraries/Animated/src/NativeAnimatedModule.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import * as TurboModuleRegistry from '../../TurboModule/TurboModuleRegistry';
1515

1616
type EndResult = {finished: boolean, ...};
1717
type EndCallback = (result: EndResult) => void;
18+
type SaveValueCallback = (value: number) => void;
1819

1920
export type EventMapping = {|
2021
nativeEventPath: Array<string>,
@@ -28,6 +29,7 @@ export type AnimatingNodeConfig = Object;
2829

2930
export interface Spec extends TurboModule {
3031
+createAnimatedNode: (tag: number, config: AnimatedNodeConfig) => void;
32+
+getValue: (tag: number, saveValueCallback: SaveValueCallback) => void;
3133
+startListeningToAnimatedNodeValue: (tag: number) => void;
3234
+stopListeningToAnimatedNodeValue: (tag: number) => void;
3335
+connectAnimatedNodes: (parentTag: number, childTag: number) => void;

Libraries/Animated/src/__tests__/AnimatedNative-test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe('Native Animated', () => {
3636

3737
beforeEach(() => {
3838
Object.assign(NativeAnimatedModule, {
39+
getValue: jest.fn(),
3940
addAnimatedEventToView: jest.fn(),
4041
connectAnimatedNodes: jest.fn(),
4142
connectAnimatedNodeToView: jest.fn(),
@@ -115,6 +116,26 @@ describe('Native Animated', () => {
115116
);
116117
});
117118

119+
it('should save value on unmount', () => {
120+
NativeAnimatedModule.getValue = jest.fn((tag, saveCallback) => {
121+
saveCallback(1);
122+
});
123+
const opacity = new Animated.Value(0);
124+
125+
opacity.__makeNative();
126+
127+
const root = TestRenderer.create(<Animated.View style={{opacity}} />);
128+
const tag = opacity.__getNativeTag();
129+
130+
root.unmount();
131+
132+
expect(NativeAnimatedModule.getValue).toBeCalledWith(
133+
tag,
134+
expect.any(Function),
135+
);
136+
expect(opacity.__getValue()).toBe(1);
137+
});
138+
118139
it('should extract offset', () => {
119140
const opacity = new Animated.Value(0);
120141
opacity.__makeNative();

0 commit comments

Comments
 (0)