Skip to content

Commit

Permalink
Merge pull request Expensify#29744 from software-mansion-labs/ts-migr…
Browse files Browse the repository at this point in the history
…ation/custom-dev-menu-component

[TS migration] Migrate 'CustomDevMenu' component to TypeScript
  • Loading branch information
roryabraham authored Nov 28, 2023
2 parents 630b722 + 60f4a50 commit f7d11ab
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 20 deletions.
5 changes: 0 additions & 5 deletions src/components/CustomDevMenu/index.js

This file was deleted.

15 changes: 0 additions & 15 deletions src/components/CustomDevMenu/index.native.js

This file was deleted.

18 changes: 18 additions & 0 deletions src/components/CustomDevMenu/index.native.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {useEffect} from 'react';
import DevMenu from 'react-native-dev-menu';
import toggleTestToolsModal from '@userActions/TestTool';
import CustomDevMenuElement from './types';

const CustomDevMenu: CustomDevMenuElement = Object.assign(
() => {
useEffect(() => {
DevMenu.addItem('Open Test Preferences', toggleTestToolsModal);
}, []);
return <></>;
},
{
displayName: 'CustomDevMenu',
},
);

export default CustomDevMenu;
5 changes: 5 additions & 0 deletions src/components/CustomDevMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import CustomDevMenuElement from './types';

const CustomDevMenu: CustomDevMenuElement = Object.assign(() => <></>, {displayName: 'CustomDevMenu'});

export default CustomDevMenu;
8 changes: 8 additions & 0 deletions src/components/CustomDevMenu/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {ReactElement} from 'react';

type CustomDevMenuElement = {
(): ReactElement;
displayName: string;
};

export default CustomDevMenuElement;

0 comments on commit f7d11ab

Please sign in to comment.