Skip to content

Commit 29a8104

Browse files
committed
Merge branch 'main' into tts-span
2 parents 4fbc54b + 0376aa4 commit 29a8104

File tree

61 files changed

+1675
-750
lines changed

Some content is hidden

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

61 files changed

+1675
-750
lines changed

Libraries/Animated/__tests__/Animated-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
*/
1010

1111
import * as React from 'react';
12-
import TestRenderer from 'react-test-renderer';
1312

1413
let Animated = require('../Animated').default;
1514
let AnimatedProps = require('../nodes/AnimatedProps').default;
15+
let TestRenderer = require('react-test-renderer');
1616

1717
jest.mock('../../BatchedBridge/NativeModules', () => ({
1818
NativeAnimatedModule: {},

Libraries/Animated/__tests__/createAnimatedComponentInjection-test.js

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,50 @@
1313

1414
import * as React from 'react';
1515

16-
const createAnimatedComponent = require('../createAnimatedComponent').default;
16+
let Animated = require('../Animated').default;
17+
const createAnimatedComponent_EXPERIMENTAL =
18+
require('../createAnimatedComponent_EXPERIMENTAL').default;
1719
const createAnimatedComponentInjection = require('../createAnimatedComponentInjection');
20+
let TestRenderer = require('react-test-renderer');
21+
22+
let callback;
1823

1924
function injected<TProps: {...}, TInstance>(
2025
Component: React.AbstractComponent<TProps, TInstance>,
2126
): React.AbstractComponent<TProps, TInstance> {
22-
return createAnimatedComponent(Component);
27+
callback();
28+
return createAnimatedComponent_EXPERIMENTAL(Component);
2329
}
2430

2531
beforeEach(() => {
2632
jest.resetModules();
2733
jest.resetAllMocks();
34+
callback = jest.fn();
2835
});
2936

3037
test('does nothing without injection', () => {
31-
expect(typeof createAnimatedComponent).toBe('function');
32-
expect(createAnimatedComponent).not.toBe(injected);
38+
const opacity = new Animated.Value(0);
39+
TestRenderer.create(<Animated.View style={{opacity}} />);
40+
expect(callback.mock.calls.length).toBe(0);
3341
});
3442

3543
test('injection overrides `createAnimatedComponent`', () => {
3644
createAnimatedComponentInjection.inject(injected);
37-
38-
expect(createAnimatedComponent).toBe(injected);
45+
const opacity = new Animated.Value(0);
46+
TestRenderer.create(<Animated.View style={{opacity}} />);
47+
expect(callback.mock.calls.length).toBe(1);
3948
});
4049

4150
test('injection errors if called too late', () => {
4251
jest.spyOn(console, 'error').mockReturnValue(undefined);
4352

44-
// Causes `createAnimatedComponent` to be initialized.
45-
createAnimatedComponent;
53+
const opacity = new Animated.Value(0);
54+
TestRenderer.create(<Animated.View style={{opacity}} />);
4655

4756
createAnimatedComponentInjection.inject(injected);
4857

49-
expect(createAnimatedComponent).not.toBe(injected);
58+
expect(callback.mock.calls.length).toBe(0);
59+
5060
expect(console.error).toBeCalledWith(
5161
'createAnimatedComponentInjection: Must be called before `createAnimatedComponent`.',
5262
);
@@ -57,7 +67,10 @@ test('injection errors if called more than once', () => {
5767

5868
createAnimatedComponentInjection.inject(injected);
5969

60-
expect(createAnimatedComponent).toBe(injected);
70+
const opacity = new Animated.Value(0);
71+
TestRenderer.create(<Animated.View style={{opacity}} />);
72+
expect(callback.mock.calls.length).toBe(1);
73+
6174
expect(console.error).not.toBeCalled();
6275

6376
createAnimatedComponentInjection.inject(injected);

Libraries/Animated/createAnimatedComponent.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
259259
}
260260
}
261261

262+
const modernAnimated = createAnimatedComponentInjection.recordAndRetrieve();
263+
if (modernAnimated != null) {
264+
// $FlowIgnore[incompatible-return] - Will be compatible after refactors.
265+
return modernAnimated(Component);
266+
}
267+
262268
return React.forwardRef(function AnimatedComponentWrapper(props, ref) {
263269
return (
264270
<AnimatedComponent
@@ -269,6 +275,4 @@ function createAnimatedComponent<Props: {+[string]: mixed, ...}, Instance>(
269275
});
270276
}
271277

272-
// $FlowIgnore[incompatible-cast] - Will be compatible after refactors.
273-
export default (createAnimatedComponentInjection.recordAndRetrieve() ??
274-
createAnimatedComponent: typeof createAnimatedComponent);
278+
export default (createAnimatedComponent: typeof createAnimatedComponent);

Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

Libraries/Components/ProgressViewIOS/ProgressViewIOS.d.ts

Lines changed: 0 additions & 62 deletions
This file was deleted.

Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js

Lines changed: 0 additions & 75 deletions
This file was deleted.

Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

Libraries/Components/ProgressViewIOS/__tests__/ProgressViewIOS-test.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

Libraries/Components/ProgressViewIOS/__tests__/__snapshots__/ProgressViewIOS-test.js.snap

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)