Skip to content

Commit 66b8bfd

Browse files
committed
fix(menu): component name to match documentation
1 parent 05dfdf6 commit 66b8bfd

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

src/components/Card/Card.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export type Props = $Omit<React.ComponentProps<typeof Surface>, 'mode'> & {
131131
* export default MyComponent;
132132
* ```
133133
*/
134-
const CardComponent = (
134+
const Card = (
135135
{
136136
elevation: cardElevation = 1,
137137
delayLongPress,
@@ -330,24 +330,24 @@ const CardComponent = (
330330
);
331331
};
332332

333-
const Component = forwardRef(CardComponent);
333+
const Component = forwardRef(Card);
334334
Component.displayName = 'Card';
335335

336-
const Card = Component as typeof Component & {
336+
const CardComponent = Component as typeof Component & {
337337
Content: typeof CardContent;
338338
Actions: typeof CardActions;
339339
Cover: typeof CardCover;
340340
Title: typeof CardTitle;
341341
};
342342

343343
// @component ./CardContent.tsx
344-
Card.Content = CardContent;
344+
CardComponent.Content = CardContent;
345345
// @component ./CardActions.tsx
346-
Card.Actions = CardActions;
346+
CardComponent.Actions = CardActions;
347347
// @component ./CardCover.tsx
348-
Card.Cover = CardCover;
348+
CardComponent.Cover = CardCover;
349349
// @component ./CardTitle.tsx
350-
Card.Title = CardTitle;
350+
CardComponent.Title = CardTitle;
351351

352352
const styles = StyleSheet.create({
353353
innerContainer: {
@@ -365,4 +365,4 @@ const styles = StyleSheet.create({
365365
},
366366
});
367367

368-
export default Card;
368+
export default CardComponent;

src/components/Menu/Menu.tsx

+8-9
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,7 @@ const DEFAULT_MODE = 'elevated';
173173
* `Modal` contents within a `PaperProvider` in order for the menu to show. This
174174
* wrapping is not necessary if you use Paper's `Modal` instead.
175175
*/
176-
class MenuComponent extends React.Component<Props, State> {
177-
// @component ./MenuItem.tsx
178-
static Item = MenuItem;
179-
176+
class Menu extends React.Component<Props, State> {
180177
static defaultProps = {
181178
overlayAccessibilityLabel: 'Close menu',
182179
testID: 'menu',
@@ -709,13 +706,15 @@ const styles = StyleSheet.create({
709706
},
710707
});
711708

712-
const MenuWithHOC = withInternalTheme(withSafeAreaInsets(MenuComponent));
709+
const Component = withInternalTheme(withSafeAreaInsets(Menu));
710+
Component.displayName = 'Menu';
713711

714-
const Menu = MenuWithHOC as typeof MenuWithHOC & {
712+
const MenuComponent = Component as typeof Component & {
715713
Item: typeof MenuItem;
716714
};
717715

718-
// we need to attach again MenuItem as it is lost after using withSafeAreaInsets
719-
Menu.Item = MenuItem;
716+
// we need to attach MenuItem here instead of a static property otherwise it will be lost after using withSafeAreaInsets
717+
// @component ./MenuItem.tsx
718+
MenuComponent.Item = MenuItem;
720719

721-
export default Menu;
720+
export default MenuComponent;

0 commit comments

Comments
 (0)