refactor: export types from the main entry instead of /types

This commit is contained in:
Satyajit Sahoo
2018-11-08 16:53:56 +01:00
parent f295272bf8
commit dec191f5c7
29 changed files with 64 additions and 43 deletions

View File

@@ -2,7 +2,7 @@
"extends": "../.eslintrc",
"settings": {
"import/core-modules": [ "react-native-paper", "react-native-paper/types" ]
"import/core-modules": [ "react-native-paper" ]
},
"rules": {

View File

@@ -7,12 +7,12 @@ import {
Provider as PaperProvider,
DarkTheme,
DefaultTheme,
type Theme,
} from 'react-native-paper';
import createReactContext from 'create-react-context';
import { createDrawerNavigator } from 'react-navigation';
import RootNavigator from './src/RootNavigator';
import DrawerItems from './DrawerItems';
import type { Theme } from 'react-native-paper/types';
type State = {
theme: Theme,

View File

@@ -9,8 +9,8 @@ import {
TouchableRipple,
Text,
Colors,
type Theme,
} from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
type Props = {
theme: Theme,

View File

@@ -6,7 +6,6 @@ module.exports = {
{
alias: {
'react-native-paper': '../src/index',
'react-native-paper/types': '../types',
'react-native-vector-icons': '@expo/vector-icons',
},
},

View File

@@ -9,8 +9,8 @@ import {
Switch,
Paragraph,
withTheme,
type Theme,
} from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
type Props = {
navigation: any,

View File

@@ -8,9 +8,9 @@ import {
ScrollView,
SafeAreaView,
Dimensions,
type Theme,
} from 'react-native';
import { Banner, withTheme, FAB } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
type Props = {
theme: Theme,

View File

@@ -2,8 +2,7 @@
import * as React from 'react';
import { View, ScrollView, StyleSheet, Image } from 'react-native';
import { Button, List, withTheme } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import { Button, List, withTheme, type Theme } from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -9,8 +9,8 @@ import {
Card,
Button,
withTheme,
type Theme,
} from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
type Props = {
theme: Theme,

View File

@@ -8,8 +8,8 @@ import {
Colors,
TouchableRipple,
withTheme,
type Theme,
} from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
type Props = {
theme: Theme,

View File

@@ -2,8 +2,7 @@
import * as React from 'react';
import { View, ScrollView, StyleSheet, Image } from 'react-native';
import { Chip, List, withTheme } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import { Chip, List, withTheme, type Theme } from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -2,7 +2,7 @@
import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { Colors, Button, withTheme } from 'react-native-paper';
import { Colors, Button, withTheme, type Theme } from 'react-native-paper';
import {
DialogWithCustomColors,
DialogWithLoadingIndicator,
@@ -10,7 +10,6 @@ import {
DialogWithRadioBtns,
UndismissableDialog,
} from './Dialogs';
import type { Theme } from 'react-native-paper/types';
type State = {
visible1: boolean,

View File

@@ -2,8 +2,7 @@
import * as React from 'react';
import { FlatList } from 'react-native';
import { Divider, List, withTheme } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import { Divider, List, withTheme, type Theme } from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -2,7 +2,7 @@
import * as React from 'react';
import { FlatList } from 'react-native';
import { List, Divider, withTheme } from 'react-native-paper';
import { List, Divider, withTheme, type Theme } from 'react-native-paper';
import AppbarExample from './AppbarExample';
import BannerExample from './BannerExample';
import BottomNavigationExample from './BottomNavigationExample';
@@ -26,7 +26,6 @@ import SwitchExample from './SwitchExample';
import TextExample from './TextExample';
import TextInputExample from './TextInputExample';
import TouchableRippleExample from './TouchableRippleExample';
import type { Theme } from 'react-native-paper/types';
type Props = {
theme: Theme,

View File

@@ -2,8 +2,7 @@
import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { Colors, FAB, Portal, withTheme } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import { Colors, FAB, Portal, withTheme, type Theme } from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -2,8 +2,7 @@
import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { IconButton, Colors, withTheme } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import { IconButton, Colors, withTheme, type Theme } from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -2,8 +2,7 @@
import * as React from 'react';
import { ScrollView, StyleSheet } from 'react-native';
import { List, Divider, withTheme } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import { List, Divider, withTheme, type Theme } from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -2,8 +2,7 @@
import * as React from 'react';
import { ScrollView, StyleSheet, Image } from 'react-native';
import { List, Divider, withTheme } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import { List, Divider, withTheme, type Theme } from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -2,8 +2,13 @@
import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { ProgressBar, Paragraph, Colors, withTheme } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import {
ProgressBar,
Paragraph,
Colors,
withTheme,
type Theme,
} from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -8,8 +8,8 @@ import {
Colors,
TouchableRipple,
withTheme,
type Theme,
} from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
type Props = {
theme: Theme,

View File

@@ -2,8 +2,13 @@
import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { Colors, withTheme, RadioButton, Paragraph } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import {
Colors,
withTheme,
RadioButton,
Paragraph,
type Theme,
} from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -2,8 +2,13 @@
import * as React from 'react';
import { StyleSheet, View } from 'react-native';
import { Colors, Caption, Searchbar, withTheme } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import {
Colors,
Caption,
Searchbar,
withTheme,
type Theme,
} from 'react-native-paper';
type Props = {
navigation: any,

View File

@@ -2,8 +2,13 @@
import * as React from 'react';
import { StyleSheet, View } from 'react-native';
import { Snackbar, Colors, withTheme, Button } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import {
Snackbar,
Colors,
withTheme,
Button,
type Theme,
} from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -2,8 +2,7 @@
import * as React from 'react';
import { ScrollView, StyleSheet } from 'react-native';
import { Text, Surface, withTheme } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import { Text, Surface, withTheme, type Theme } from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -8,8 +8,8 @@ import {
Colors,
TouchableRipple,
withTheme,
type Theme,
} from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
type Props = {
theme: Theme,

View File

@@ -9,8 +9,8 @@ import {
Subheading,
Title,
withTheme,
type Theme,
} from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
type Props = {
theme: Theme,

View File

@@ -6,9 +6,9 @@ import {
View,
ScrollView,
KeyboardAvoidingView,
type Theme,
} from 'react-native';
import { TextInput, HelperText, withTheme } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
type Props = {
theme: Theme,

View File

@@ -1,8 +1,12 @@
/* @flow */
import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { TouchableRipple, withTheme, Paragraph } from 'react-native-paper';
import type { Theme } from 'react-native-paper/types';
import {
TouchableRipple,
withTheme,
Paragraph,
type Theme,
} from 'react-native-paper';
type Props = {
theme: Theme,

View File

@@ -1,6 +1,9 @@
/* @flow */
import * as Colors from './styles/colors';
import type { Theme as _Theme } from './types';
export type Theme = _Theme;
export { Colors };

View File

@@ -1,4 +1,9 @@
/* @flow */
/**
* This file is only for backwards compatibility
* Import the Theme type from the main entry point instead
*
* @flow
*/
import type { Theme as _Theme } from './src/types';