Skip to content

Commit ac43ee1

Browse files
fabriziocuccifacebook-github-bot
authored andcommitted
Convert Button to ESM (#42796)
Summary: Pull Request resolved: #42796 As per title. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D53308084 fbshipit-source-id: 872f828b8dc019e65cd32549f9633efb6cde18f5
1 parent 069c244 commit ac43ee1

File tree

4 files changed

+10
-274
lines changed

4 files changed

+10
-274
lines changed

packages/react-native/Libraries/Components/Button.flow.js

-264
This file was deleted.

packages/react-native/Libraries/Components/Button.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import type {TextStyleProp, ViewStyleProp} from '../StyleSheet/StyleSheet';
1414
import type {PressEvent} from '../Types/CoreEventTypes';
15-
import type {Button as ButtonType} from './Button.flow';
1615
import type {
1716
AccessibilityActionEvent,
1817
AccessibilityActionInfo,
@@ -429,4 +428,4 @@ const styles = StyleSheet.create({
429428
}),
430429
});
431430

432-
module.exports = (Button: ButtonType);
431+
export default Button;

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

+8-7
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ declare export default typeof ActivityIndicatorViewNativeComponent;
16541654
"
16551655
`;
16561656

1657-
exports[`public API should not change unintentionally Libraries/Components/Button.flow.js 1`] = `
1657+
exports[`public API should not change unintentionally Libraries/Components/Button.js 1`] = `
16581658
"type ButtonProps = $ReadOnly<{|
16591659
title: string,
16601660
onPress: (event?: PressEvent) => mixed,
@@ -1674,16 +1674,17 @@ exports[`public API should not change unintentionally Libraries/Components/Butto
16741674
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
16751675
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
16761676
accessibilityState?: ?AccessibilityState,
1677+
\\"aria-busy\\"?: ?boolean,
1678+
\\"aria-checked\\"?: ?boolean | \\"mixed\\",
1679+
\\"aria-disabled\\"?: ?boolean,
1680+
\\"aria-expanded\\"?: ?boolean,
1681+
\\"aria-selected\\"?: ?boolean,
16771682
importantForAccessibility?: ?(\\"auto\\" | \\"yes\\" | \\"no\\" | \\"no-hide-descendants\\"),
16781683
accessibilityHint?: ?string,
16791684
accessibilityLanguage?: ?Stringish,
16801685
|}>;
1681-
export type Button = React.ComponentType<ButtonProps>;
1682-
"
1683-
`;
1684-
1685-
exports[`public API should not change unintentionally Libraries/Components/Button.js 1`] = `
1686-
"declare module.exports: ButtonType;
1686+
declare const Button: React.AbstractComponent<ButtonProps>;
1687+
declare export default typeof Button;
16871688
"
16881689
`;
16891690

packages/react-native/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ module.exports = {
112112
.default;
113113
},
114114
get Button(): Button {
115-
return require('./Libraries/Components/Button');
115+
return require('./Libraries/Components/Button').default;
116116
},
117117
// $FlowFixMe[value-as-type]
118118
get DrawerLayoutAndroid(): DrawerLayoutAndroid {

0 commit comments

Comments
 (0)