Skip to content

Commit

Permalink
ESM ActivityIndicator
Browse files Browse the repository at this point in the history
Summary: Changelog: [General][Changed] ActivityIndicator and remove .flow

Reviewed By: yungsters

Differential Revision: D42203449

fbshipit-source-id: 52ab1111166d23b7304e8406f299d23f9fd6f399
  • Loading branch information
lunaleaps authored and facebook-github-bot committed Jan 4, 2023
1 parent 9af5c33 commit 9c57a7f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 68 deletions.
58 changes: 0 additions & 58 deletions Libraries/Components/ActivityIndicator/ActivityIndicator.flow.js

This file was deleted.

10 changes: 6 additions & 4 deletions Libraries/Components/ActivityIndicator/ActivityIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*/

'use strict';
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
import type {ViewProps} from '../View/ViewPropTypes';
import type {ActivityIndicator as ActivityIndicatorType} from './ActivityIndicator.flow';

import StyleSheet, {type ColorValue} from '../../StyleSheet/StyleSheet';
import Platform from '../../Utilities/Platform';
Expand Down Expand Up @@ -184,8 +184,10 @@ const ActivityIndicator = (
```
*/

const ActivityIndicatorWithRef: ActivityIndicatorType =
React.forwardRef(ActivityIndicator);
const ActivityIndicatorWithRef: React.AbstractComponent<
Props,
HostComponent<mixed>,
> = React.forwardRef(ActivityIndicator);
ActivityIndicatorWithRef.displayName = 'ActivityIndicator';

const styles = StyleSheet.create({
Expand All @@ -203,4 +205,4 @@ const styles = StyleSheet.create({
},
});

module.exports = ActivityIndicatorWithRef;
export default ActivityIndicatorWithRef;
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@

'use strict';

import * as React from 'react';

const ReactNativeTestTools = require('../../../Utilities/ReactNativeTestTools');
const ActivityIndicator = require('../ActivityIndicator');
const React = require('react');
const ActivityIndicator = require('../ActivityIndicator').default;

describe('<ActivityIndicator />', () => {
it('should set displayName to prevent <Component /> regressions', () => {
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ module.exports = {
.default;
},
get ActivityIndicator(): ActivityIndicator {
return require('./Libraries/Components/ActivityIndicator/ActivityIndicator');
return require('./Libraries/Components/ActivityIndicator/ActivityIndicator')
.default;
},
get Button(): Button {
return require('./Libraries/Components/Button');
Expand Down
9 changes: 6 additions & 3 deletions jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,14 @@ jest
const mockScrollView = jest.requireActual('./mockScrollView');
return mockScrollView(baseComponent);
})
.mock('../Libraries/Components/ActivityIndicator/ActivityIndicator', () =>
mockComponent(
.mock('../Libraries/Components/ActivityIndicator/ActivityIndicator', () => ({
__esModule: true,
default: mockComponent(
'../Libraries/Components/ActivityIndicator/ActivityIndicator',
null,
true,
),
)
}))
.mock('../Libraries/AppState/AppState', () => ({
addEventListener: jest.fn(() => ({
remove: jest.fn(),
Expand Down

0 comments on commit 9c57a7f

Please sign in to comment.