Skip to content

Commit

Permalink
Convert Button to ESM (#42796)
Browse files Browse the repository at this point in the history
Summary:

As per title.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53308084
  • Loading branch information
fabriziocucci authored and facebook-github-bot committed Feb 1, 2024
1 parent 3f8a450 commit 86be495
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 274 deletions.
264 changes: 0 additions & 264 deletions packages/react-native/Libraries/Components/Button.flow.js

This file was deleted.

3 changes: 1 addition & 2 deletions packages/react-native/Libraries/Components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import type {TextStyleProp, ViewStyleProp} from '../StyleSheet/StyleSheet';
import type {PressEvent} from '../Types/CoreEventTypes';
import type {Button as ButtonType} from './Button.flow';
import type {
AccessibilityActionEvent,
AccessibilityActionInfo,
Expand Down Expand Up @@ -429,4 +428,4 @@ const styles = StyleSheet.create({
}),
});

module.exports = (Button: ButtonType);
export default Button;
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,7 @@ declare export default typeof ActivityIndicatorViewNativeComponent;
"
`;

exports[`public API should not change unintentionally Libraries/Components/Button.flow.js 1`] = `
exports[`public API should not change unintentionally Libraries/Components/Button.js 1`] = `
"type ButtonProps = $ReadOnly<{|
title: string,
onPress: (event?: PressEvent) => mixed,
Expand All @@ -1674,16 +1674,17 @@ exports[`public API should not change unintentionally Libraries/Components/Butto
accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
accessibilityState?: ?AccessibilityState,
\\"aria-busy\\"?: ?boolean,
\\"aria-checked\\"?: ?boolean | \\"mixed\\",
\\"aria-disabled\\"?: ?boolean,
\\"aria-expanded\\"?: ?boolean,
\\"aria-selected\\"?: ?boolean,
importantForAccessibility?: ?(\\"auto\\" | \\"yes\\" | \\"no\\" | \\"no-hide-descendants\\"),
accessibilityHint?: ?string,
accessibilityLanguage?: ?Stringish,
|}>;
export type Button = React.ComponentType<ButtonProps>;
"
`;

exports[`public API should not change unintentionally Libraries/Components/Button.js 1`] = `
"declare module.exports: ButtonType;
declare const Button: React.AbstractComponent<ButtonProps>;
declare export default typeof Button;
"
`;

Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ module.exports = {
.default;
},
get Button(): Button {
return require('./Libraries/Components/Button');
return require('./Libraries/Components/Button').default;
},
// $FlowFixMe[value-as-type]
get DrawerLayoutAndroid(): DrawerLayoutAndroid {
Expand Down

0 comments on commit 86be495

Please sign in to comment.