diff --git a/src/babel/__fixtures__/rewrite-imports/output.js b/src/babel/__fixtures__/rewrite-imports/output.js index 768cb68e54..1f3d805f80 100644 --- a/src/babel/__fixtures__/rewrite-imports/output.js +++ b/src/babel/__fixtures__/rewrite-imports/output.js @@ -3,8 +3,8 @@ import { Text } from 'react-native'; import PaperProvider from "react-native-paper/lib/module/core/Provider"; import BottomNavigation from "react-native-paper/lib/module/components/BottomNavigation"; import Button from "react-native-paper/lib/module/components/Button"; -import FAB from "react-native-paper/lib/module/components/FAB/FAB"; -import Appbar from "react-native-paper/lib/module/components/Appbar/Appbar"; +import FAB from "react-native-paper/lib/module/components/FAB"; +import Appbar from "react-native-paper/lib/module/components/Appbar"; import * as Colors from "react-native-paper/lib/module/styles/colors"; import { NonExistent, NonExistentSecond as Stuff, Theme } from "react-native-paper/lib/module/index.js"; import { ThemeProvider } from "react-native-paper/lib/module/core/theming"; diff --git a/src/components/Appbar/Appbar.tsx b/src/components/Appbar/Appbar.tsx index 8c6f9e2008..adde66bf79 100644 --- a/src/components/Appbar/Appbar.tsx +++ b/src/components/Appbar/Appbar.tsx @@ -2,12 +2,9 @@ import * as React from 'react'; import { View, ViewStyle, Platform, StyleSheet, StyleProp } from 'react-native'; import color from 'color'; -import { - AppbarContent, - AppbarAction, - AppbarBackAction, - AppbarHeader, -} from './AppbarElements'; +import AppbarContent from './AppbarContent'; +import AppbarAction from './AppbarAction'; +import AppbarBackAction from './AppbarBackAction'; import Surface from '../Surface'; import { withTheme } from '../../core/theming'; import { black, white } from '../../styles/colors'; @@ -171,15 +168,6 @@ const Appbar = ({ children, dark, style, theme, ...rest }: Props) => { ); }; -// @component ./AppbarContent.tsx -Appbar.Content = AppbarContent; -// @component ./AppbarAction.tsx -Appbar.Action = AppbarAction; -// @component ./AppbarBackAction.tsx -Appbar.BackAction = AppbarBackAction; -// @component ./AppbarHeader.tsx -Appbar.Header = AppbarHeader; - const styles = StyleSheet.create({ appbar: { height: DEFAULT_APPBAR_HEIGHT, diff --git a/src/components/Appbar/AppbarBackAction.tsx b/src/components/Appbar/AppbarBackAction.tsx index 7cc483937b..303c34170a 100644 --- a/src/components/Appbar/AppbarBackAction.tsx +++ b/src/components/Appbar/AppbarBackAction.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import type { $Omit } from './../../types'; -import { AppbarAction, AppbarBackIcon } from './AppbarElements'; +import AppbarAction from './AppbarAction'; +import AppbarBackIcon from './AppbarBackIcon'; import type { StyleProp, ViewStyle } from 'react-native'; type Props = $Omit< diff --git a/src/components/Appbar/AppbarElements.tsx b/src/components/Appbar/AppbarElements.tsx deleted file mode 100644 index bbde3a135e..0000000000 --- a/src/components/Appbar/AppbarElements.tsx +++ /dev/null @@ -1,6 +0,0 @@ -export { Appbar } from './Appbar'; -export { AppbarAction } from './AppbarAction'; -export { AppbarBackAction } from './AppbarBackAction'; -export { AppbarBackIcon } from './AppbarBackIcon'; -export { AppbarContent } from './AppbarContent'; -export { AppbarHeader } from './AppbarHeader'; diff --git a/src/components/Appbar/AppbarHeader.tsx b/src/components/Appbar/AppbarHeader.tsx index 54232f5677..b7136d8074 100644 --- a/src/components/Appbar/AppbarHeader.tsx +++ b/src/components/Appbar/AppbarHeader.tsx @@ -7,8 +7,7 @@ import { ViewStyle, } from 'react-native'; import overlay from '../../styles/overlay'; -import { Appbar } from './AppbarElements'; -import { DEFAULT_APPBAR_HEIGHT } from './Appbar'; +import { DEFAULT_APPBAR_HEIGHT, Appbar } from './Appbar'; import shadow from '../../styles/shadow'; import { withTheme } from '../../core/theming'; import { APPROX_STATUSBAR_HEIGHT } from '../../constants'; diff --git a/src/components/Appbar/index.ts b/src/components/Appbar/index.ts new file mode 100644 index 0000000000..2d6140d6d5 --- /dev/null +++ b/src/components/Appbar/index.ts @@ -0,0 +1,22 @@ +import AppbarComponent from './Appbar'; +import AppbarContent from './AppbarContent'; +import AppbarAction from './AppbarAction'; +import AppbarBackAction from './AppbarBackAction'; +import AppbarHeader from './AppbarHeader'; + +const Appbar = Object.assign( + // @component ./Appbar.tsx + AppbarComponent, + { + // @component ./AppbarContent.tsx + Content: AppbarContent, + // @component ./AppbarAction.tsx + Action: AppbarAction, + // @component ./AppbarBackAction.tsx + BackAction: AppbarBackAction, + // @component ./AppbarHeader.tsx + Header: AppbarHeader, + } +); + +export default Appbar; diff --git a/src/components/Checkbox/Checkbox.tsx b/src/components/Checkbox/Checkbox.tsx index 12c8e50c33..9d2ce2d5b5 100644 --- a/src/components/Checkbox/Checkbox.tsx +++ b/src/components/Checkbox/Checkbox.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import { Platform } from 'react-native'; -import { CheckboxIOS, CheckboxItem, CheckboxAndroid } from './CheckboxElements'; +import CheckboxIOS from './CheckboxIOS'; +import CheckboxAndroid from './CheckboxAndroid'; import { withTheme } from '../../core/theming'; type Props = { @@ -84,15 +85,6 @@ const Checkbox = (props: Props) => ); -// @component ./CheckboxItem.tsx -Checkbox.Item = CheckboxItem; - -// @component ./CheckboxAndroid.tsx -Checkbox.Android = CheckboxAndroid; - -// @component ./CheckboxIOS.tsx -Checkbox.IOS = CheckboxIOS; - export default withTheme(Checkbox); // @component-docs ignore-next-line diff --git a/src/components/Checkbox/CheckboxElements.tsx b/src/components/Checkbox/CheckboxElements.tsx deleted file mode 100644 index 2b88791314..0000000000 --- a/src/components/Checkbox/CheckboxElements.tsx +++ /dev/null @@ -1,4 +0,0 @@ -export { Checkbox } from './Checkbox'; -export { CheckboxAndroid } from './CheckboxAndroid'; -export { CheckboxIOS } from './CheckboxIOS'; -export { CheckboxItem } from './CheckboxItem'; diff --git a/src/components/Checkbox/CheckboxItem.tsx b/src/components/Checkbox/CheckboxItem.tsx index 47c30e2a33..1d93670218 100644 --- a/src/components/Checkbox/CheckboxItem.tsx +++ b/src/components/Checkbox/CheckboxItem.tsx @@ -8,7 +8,9 @@ import { ViewStyle, } from 'react-native'; -import { Checkbox, CheckboxAndroid, CheckboxIOS } from './CheckboxElements'; +import Checkbox from './Checkbox'; +import CheckboxAndroid from './CheckboxAndroid'; +import CheckboxIOS from './CheckboxIOS'; import Text from '../Typography/Text'; import TouchableRipple from '../TouchableRipple/TouchableRipple'; import { withTheme } from '../../core/theming'; diff --git a/src/components/Checkbox/index.ts b/src/components/Checkbox/index.ts new file mode 100644 index 0000000000..cf2cd27d96 --- /dev/null +++ b/src/components/Checkbox/index.ts @@ -0,0 +1,19 @@ +import CheckboxComponent from './Checkbox'; +import CheckboxItem from './CheckboxItem'; +import CheckboxAndroid from './CheckboxAndroid'; +import CheckboxIOS from './CheckboxIOS'; + +const Checkbox = Object.assign( + // @component ./Checkbox.tsx + CheckboxComponent, + { + // @component ./CheckboxItem.tsx + Item: CheckboxItem, + // @component ./CheckboxAndroid.tsx + Android: CheckboxAndroid, + // @component ./CheckboxIOS.tsx + IOS: CheckboxIOS, + } +); + +export default Checkbox; diff --git a/src/components/FAB/FAB.tsx b/src/components/FAB/FAB.tsx index 668399ffeb..aa530342ba 100644 --- a/src/components/FAB/FAB.tsx +++ b/src/components/FAB/FAB.tsx @@ -12,7 +12,6 @@ import { withTheme } from '../../core/theming'; import type { $RemoveChildren } from '../../types'; import type { IconSource } from './../Icon'; import type { AccessibilityState } from 'react-native'; -import { FABGroup } from './FABElements'; type Props = $RemoveChildren & { /** @@ -244,9 +243,6 @@ const FAB = ({ ); }; -// @component ./FABGroup.tsx -FAB.Group = FABGroup; - const styles = StyleSheet.create({ container: { borderRadius: 28, diff --git a/src/components/FAB/FABElements.tsx b/src/components/FAB/FABElements.tsx deleted file mode 100644 index f2e84ad67a..0000000000 --- a/src/components/FAB/FABElements.tsx +++ /dev/null @@ -1,2 +0,0 @@ -export { FABGroup } from './FABGroup'; -export { FAB } from './FAB'; diff --git a/src/components/FAB/FABGroup.tsx b/src/components/FAB/FABGroup.tsx index 2abd7b30f7..d8d79dc636 100644 --- a/src/components/FAB/FABGroup.tsx +++ b/src/components/FAB/FABGroup.tsx @@ -9,7 +9,7 @@ import { ViewStyle, } from 'react-native'; import color from 'color'; -import { FAB } from './FABElements'; +import FAB from './FAB'; import Text from '../Typography/Text'; import Card from '../Card/Card'; import { withTheme } from '../../core/theming'; diff --git a/src/components/FAB/index.ts b/src/components/FAB/index.ts new file mode 100644 index 0000000000..4364bc7411 --- /dev/null +++ b/src/components/FAB/index.ts @@ -0,0 +1,13 @@ +import FABComponent from './FAB'; +import FABGroup from './FABGroup'; + +const FAB = Object.assign( + // @component ./FAB.tsx + FABComponent, + { + // @component ./FABGroup.tsx + Group: FABGroup, + } +); + +export default FAB; diff --git a/src/components/RadioButton/RadioButton.tsx b/src/components/RadioButton/RadioButton.tsx index b36de5bafd..35afa3d636 100644 --- a/src/components/RadioButton/RadioButton.tsx +++ b/src/components/RadioButton/RadioButton.tsx @@ -1,11 +1,7 @@ import * as React from 'react'; import { Platform } from 'react-native'; -import { - RadioButtonAndroid, - RadioButtonGroup, - RadioButtonIOS, - RadioButtonItem, -} from './RadioButtonElements'; +import RadioButtonAndroid from './RadioButtonAndroid'; +import RadioButtonIOS from './RadioButtonIOS'; import { withTheme } from '../../core/theming'; export type Props = { @@ -102,18 +98,6 @@ const RadioButton = (props: Props) => { return