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 ;
};
-// @component ./RadioButtonGroup.tsx
-RadioButton.Group = RadioButtonGroup;
-
-// @component ./RadioButtonAndroid.tsx
-RadioButton.Android = RadioButtonAndroid;
-
-// @component ./RadioButtonIOS.tsx
-RadioButton.IOS = RadioButtonIOS;
-
-// @component ./RadioButtonItem.tsx
-RadioButton.Item = RadioButtonItem;
-
export default withTheme(RadioButton);
// @component-docs ignore-next-line
diff --git a/src/components/RadioButton/RadioButtonElements.tsx b/src/components/RadioButton/RadioButtonElements.tsx
deleted file mode 100644
index 4ef21de368..0000000000
--- a/src/components/RadioButton/RadioButtonElements.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-export { RadioButton } from './RadioButton';
-export { RadioButtonAndroid } from './RadioButtonAndroid';
-export { RadioButtonGroup } from './RadioButtonGroup';
-export { RadioButtonIOS } from './RadioButtonIOS';
-export { RadioButtonItem } from './RadioButtonItem';
diff --git a/src/components/RadioButton/RadioButtonItem.tsx b/src/components/RadioButton/RadioButtonItem.tsx
index d25794476c..ec561aa981 100644
--- a/src/components/RadioButton/RadioButtonItem.tsx
+++ b/src/components/RadioButton/RadioButtonItem.tsx
@@ -10,7 +10,7 @@ import { withTheme } from '../../core/theming';
import { RadioButtonContext, RadioButtonContextType } from './RadioButtonGroup';
import { handlePress } from './utils';
import TouchableRipple from '../TouchableRipple/TouchableRipple';
-import { RadioButton } from './RadioButtonElements';
+import RadioButton from './RadioButton';
import Text from '../Typography/Text';
import RadioButtonAndroid from './RadioButtonAndroid';
import RadioButtonIOS from './RadioButtonIOS';
diff --git a/src/components/RadioButton/index.ts b/src/components/RadioButton/index.ts
new file mode 100644
index 0000000000..c882b28580
--- /dev/null
+++ b/src/components/RadioButton/index.ts
@@ -0,0 +1,22 @@
+import RadioButtonComponent from './RadioButton';
+import RadioButtonGroup from './RadioButtonGroup';
+import RadioButtonAndroid from './RadioButtonAndroid';
+import RadioButtonIOS from './RadioButtonIOS';
+import RadioButtonItem from './RadioButtonItem';
+
+const RadioButton = Object.assign(
+ // @component ./RadioButton.tsx
+ RadioButtonComponent,
+ {
+ // @component ./RadioButtonGroup.tsx
+ Group: RadioButtonGroup,
+ // @component ./RadioButtonAndroid.tsx
+ Android: RadioButtonAndroid,
+ // @component ./RadioButtonIOS.tsx
+ IOS: RadioButtonIOS,
+ // @component ./RadioButtonItem.tsx
+ Item: RadioButtonItem,
+ }
+);
+
+export default RadioButton;
diff --git a/src/components/ToggleButton/ToggleButton.tsx b/src/components/ToggleButton/ToggleButton.tsx
index a8be3c7df0..686a4c0df3 100644
--- a/src/components/ToggleButton/ToggleButton.tsx
+++ b/src/components/ToggleButton/ToggleButton.tsx
@@ -11,7 +11,6 @@ import IconButton from '../IconButton';
import { ToggleButtonGroupContext } from './ToggleButtonGroup';
import { black, white } from '../../styles/colors';
import type { IconSource } from '../Icon';
-import { ToggleButtonRow, ToggleButtonGroup } from './ToggleButtonElements';
type Props = {
/**
@@ -154,12 +153,6 @@ const ToggleButton = ({
);
};
-// @component ./ToggleButtonGroup.tsx
-ToggleButton.Group = ToggleButtonGroup;
-
-// @component ./ToggleButtonRow.tsx
-ToggleButton.Row = ToggleButtonRow;
-
const styles = StyleSheet.create({
content: {
width: 42,
diff --git a/src/components/ToggleButton/ToggleButtonElements.tsx b/src/components/ToggleButton/ToggleButtonElements.tsx
deleted file mode 100644
index 29c574498e..0000000000
--- a/src/components/ToggleButton/ToggleButtonElements.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export { ToggleButton } from './ToggleButton';
-export { ToggleButtonRow } from './ToggleButtonRow';
-export { ToggleButtonGroup } from './ToggleButtonGroup';
diff --git a/src/components/ToggleButton/ToggleButtonRow.tsx b/src/components/ToggleButton/ToggleButtonRow.tsx
index 080bf7487c..40cfe14b20 100644
--- a/src/components/ToggleButton/ToggleButtonRow.tsx
+++ b/src/components/ToggleButton/ToggleButtonRow.tsx
@@ -1,6 +1,7 @@
import * as React from 'react';
import { StyleSheet, View, StyleProp, ViewStyle } from 'react-native';
-import { ToggleButton } from './ToggleButtonElements';
+import ToggleButtonGroup from './ToggleButtonGroup';
+import ToggleButton from './ToggleButton';
type Props = {
/**
@@ -51,7 +52,7 @@ const ToggleButtonRow = ({ value, onValueChange, children, style }: Props) => {
const count = React.Children.count(children);
return (
-
+
{React.Children.map(children, (child, i) => {
// @ts-ignore
@@ -74,7 +75,7 @@ const ToggleButtonRow = ({ value, onValueChange, children, style }: Props) => {
return child;
})}
-
+
);
};
diff --git a/src/components/ToggleButton/index.ts b/src/components/ToggleButton/index.ts
new file mode 100644
index 0000000000..222d93fb52
--- /dev/null
+++ b/src/components/ToggleButton/index.ts
@@ -0,0 +1,16 @@
+import ToggleButtonComponent from './ToggleButton';
+import ToggleButtonGroup from './ToggleButtonGroup';
+import ToggleButtonRow from './ToggleButtonRow';
+
+const ToggleButton = Object.assign(
+ // @component ./ToggleButton.tsx
+ ToggleButtonComponent,
+ {
+ // @component ./ToggleButtonGroup.tsx
+ Group: ToggleButtonGroup,
+ // @component ./ToggleButtonRow.tsx
+ Row: ToggleButtonRow,
+ }
+);
+
+export default ToggleButton;
diff --git a/src/components/__tests__/Appbar/Appbar.test.js b/src/components/__tests__/Appbar/Appbar.test.js
index 1c07030f23..8f980c67d2 100644
--- a/src/components/__tests__/Appbar/Appbar.test.js
+++ b/src/components/__tests__/Appbar/Appbar.test.js
@@ -1,6 +1,6 @@
import React from 'react';
import renderer from 'react-test-renderer';
-import Appbar from '../../Appbar/Appbar';
+import Appbar from '../../Appbar';
import Searchbar from '../../Searchbar';
describe('Appbar', () => {
diff --git a/src/components/__tests__/Checkbox/Checkbox.test.js b/src/components/__tests__/Checkbox/Checkbox.test.js
index eb84be77e3..12b4e270fb 100644
--- a/src/components/__tests__/Checkbox/Checkbox.test.js
+++ b/src/components/__tests__/Checkbox/Checkbox.test.js
@@ -1,6 +1,6 @@
import * as React from 'react';
import renderer from 'react-test-renderer';
-import Checkbox from '../../Checkbox/Checkbox';
+import Checkbox from '../../Checkbox';
it('renders checked Checkbox with onPress', () => {
const tree = renderer
diff --git a/src/components/__tests__/Checkbox/CheckboxItem.test.js b/src/components/__tests__/Checkbox/CheckboxItem.test.js
index cdf2f4952d..e0740ed3aa 100644
--- a/src/components/__tests__/Checkbox/CheckboxItem.test.js
+++ b/src/components/__tests__/Checkbox/CheckboxItem.test.js
@@ -1,7 +1,7 @@
import * as React from 'react';
import { Platform } from 'react-native';
import renderer from 'react-test-renderer';
-import Checkbox from '../../Checkbox/Checkbox';
+import Checkbox from '../../Checkbox';
it('renders unchecked', () => {
const tree = renderer
diff --git a/src/components/__tests__/FAB.test.js b/src/components/__tests__/FAB.test.js
index 11bb069fc9..58d3f3a841 100644
--- a/src/components/__tests__/FAB.test.js
+++ b/src/components/__tests__/FAB.test.js
@@ -1,6 +1,6 @@
import * as React from 'react';
import renderer from 'react-test-renderer';
-import FAB from '../FAB/FAB';
+import FAB from '../FAB';
it('renders normal FAB', () => {
const tree = renderer.create( {}} icon="plus" />).toJSON();
diff --git a/src/components/__tests__/RadioButton/RadioButton.test.js b/src/components/__tests__/RadioButton/RadioButton.test.js
index 35045a880e..bd7f43556f 100644
--- a/src/components/__tests__/RadioButton/RadioButton.test.js
+++ b/src/components/__tests__/RadioButton/RadioButton.test.js
@@ -1,7 +1,7 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { RadioButtonContext } from '../../RadioButton/RadioButtonGroup';
-import RadioButton from '../../RadioButton/RadioButton';
+import RadioButton from '../../RadioButton';
describe('RadioButton', () => {
afterEach(() => jest.resetModules());
diff --git a/src/components/__tests__/RadioButton/RadioButtonGroup.test.js b/src/components/__tests__/RadioButton/RadioButtonGroup.test.js
index a2b9314341..b204f435fc 100644
--- a/src/components/__tests__/RadioButton/RadioButtonGroup.test.js
+++ b/src/components/__tests__/RadioButton/RadioButtonGroup.test.js
@@ -1,6 +1,6 @@
import React from 'react';
import renderer from 'react-test-renderer';
-import RadioButton from '../../RadioButton/RadioButton';
+import RadioButton from '../../RadioButton';
describe('RadioButtonGroup', () => {
it('renders properly', () => {
diff --git a/src/components/__tests__/RadioButton/RadioButtonItem.test.js b/src/components/__tests__/RadioButton/RadioButtonItem.test.js
index d9201885b9..c4975e23c4 100644
--- a/src/components/__tests__/RadioButton/RadioButtonItem.test.js
+++ b/src/components/__tests__/RadioButton/RadioButtonItem.test.js
@@ -1,7 +1,7 @@
import * as React from 'react';
import { Platform } from 'react-native';
import renderer from 'react-test-renderer';
-import RadioButton from '../../RadioButton/RadioButton';
+import RadioButton from '../../RadioButton';
it('renders unchecked', () => {
const tree = renderer
diff --git a/src/components/__tests__/ToggleButton.test.js b/src/components/__tests__/ToggleButton.test.js
index b6331015c0..5506006191 100644
--- a/src/components/__tests__/ToggleButton.test.js
+++ b/src/components/__tests__/ToggleButton.test.js
@@ -1,6 +1,6 @@
import * as React from 'react';
import renderer from 'react-test-renderer';
-import ToggleButton from '../ToggleButton/ToggleButton';
+import ToggleButton from '../ToggleButton';
it('renders toggle button', () => {
const tree = renderer
diff --git a/src/index.tsx b/src/index.tsx
index f7e395a7c5..871bd69d00 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -23,27 +23,27 @@ export { default as Banner } from './components/Banner';
export { default as BottomNavigation } from './components/BottomNavigation';
export { default as Button } from './components/Button';
export { default as Card } from './components/Card/Card';
-export { default as Checkbox } from './components/Checkbox/Checkbox';
+export { default as Checkbox } from './components/Checkbox';
export { default as Chip } from './components/Chip';
export { default as DataTable } from './components/DataTable/DataTable';
export { default as Dialog } from './components/Dialog/Dialog';
export { default as Divider } from './components/Divider';
-export { default as FAB } from './components/FAB/FAB';
+export { default as FAB } from './components/FAB';
export { default as HelperText } from './components/HelperText';
export { default as IconButton } from './components/IconButton';
export { default as Menu } from './components/Menu/Menu';
export { default as Modal } from './components/Modal';
export { default as Portal } from './components/Portal/Portal';
export { default as ProgressBar } from './components/ProgressBar';
-export { default as RadioButton } from './components/RadioButton/RadioButton';
+export { default as RadioButton } from './components/RadioButton';
export { default as Searchbar } from './components/Searchbar';
export { default as Snackbar } from './components/Snackbar';
export { default as Surface } from './components/Surface';
export { default as Switch } from './components/Switch';
-export { default as Appbar } from './components/Appbar/Appbar';
+export { default as Appbar } from './components/Appbar';
export { default as TouchableRipple } from './components/TouchableRipple/TouchableRipple';
export { default as TextInput } from './components/TextInput/TextInput';
-export { default as ToggleButton } from './components/ToggleButton/ToggleButton';
+export { default as ToggleButton } from './components/ToggleButton';
export { default as Caption } from './components/Typography/Caption';
export { default as Headline } from './components/Typography/Headline';