Skip to content

Commit

Permalink
feat: export components types and props
Browse files Browse the repository at this point in the history
  • Loading branch information
EslamElMeniawy committed Aug 18, 2022
1 parent 2bb50a2 commit 1faaf68
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/components/AlertDialog.tsx
Expand Up @@ -46,12 +46,12 @@ const styles = ScaledSheet.create({
// #endregion

// #region Types
interface Action {
export interface Action {
action?: string;
actionProps?: ButtonProps;
}

interface Props {
export interface Props {
dialogProps?: DialogProps;
title?: string;
titleProps?: TextProps;
Expand Down
9 changes: 1 addition & 8 deletions src/components/Button.tsx
Expand Up @@ -11,6 +11,7 @@ import type { Theme } from 'react-native-paper/lib/typescript/types';
// Internal imports.
import Text from './Text';
import type { Props as TextProps } from './Text';
import type { IconProps } from './IconButton';

// #region Styles
const styles = ScaledSheet.create({
Expand Down Expand Up @@ -63,14 +64,6 @@ export interface Props extends ViewProps {
interface PropsWithTheme extends Props {
theme: Theme;
}

interface IconProps {
image?: number;
vector?: number;
iconName?: string;
size: number;
color?: string;
}
// #endregion

const getIcon = (props: IconProps): null | React.ReactElement => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card.tsx
Expand Up @@ -19,7 +19,7 @@ const styles = ScaledSheet.create({
// #endregion

// #region Types
type Props = React.ComponentProps<typeof PaperCard>;
export type Props = React.ComponentProps<typeof PaperCard>;

type PropsWithTheme = Props & {
theme: Theme;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Checkbox.tsx
Expand Up @@ -46,7 +46,7 @@ const styles = ScaledSheet.create({
// #endregion

// #region Types
interface Props extends ViewProps {
export interface Props extends ViewProps {
text?: string;
checked?: boolean;
onPress?: () => void;
Expand Down
2 changes: 1 addition & 1 deletion src/components/FlatList.tsx
Expand Up @@ -28,7 +28,7 @@ const styles = ScaledSheet.create({
// #endregion

// #region Types
interface Props extends FlatListProps<FlatListItem> {
export interface Props extends FlatListProps<FlatListItem> {
refreshColor?: string;
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/IconButton.tsx
Expand Up @@ -38,7 +38,7 @@ const styles = ScaledSheet.create({
// #endregion

// #region Types
interface Props extends ViewProps {
export interface Props extends ViewProps {
image?: number;
vector?: number;
iconName?: string;
Expand All @@ -53,12 +53,12 @@ interface PropsWithTheme extends Props {
theme: Theme;
}

interface IconProps {
export interface IconProps {
image?: number;
vector?: number;
iconName?: string;
size: number;
color: string;
color?: string;
iconPercent?: number;
}
// #endregion
Expand Down
12 changes: 6 additions & 6 deletions src/components/ImagePlaceholder.tsx
Expand Up @@ -36,13 +36,13 @@ const styles = ScaledSheet.create({
// #endregion

// #region Types
type ResizeModeType = 'cover' | 'contain' | 'stretch' | 'center';
export type ResizeModeType = 'cover' | 'contain' | 'stretch' | 'center';

type PriorityType = 'low' | 'normal' | 'high';
export type PriorityType = 'low' | 'normal' | 'high';

type CacheType = 'immutable' | 'web' | 'cacheOnly';
export type CacheType = 'immutable' | 'web' | 'cacheOnly';

interface Props extends ViewProps {
export interface Props extends ViewProps {
size?: number;
source?: string;
placeholder?: number;
Expand All @@ -56,13 +56,13 @@ interface PropsWithTheme extends Props {
theme: Theme;
}

interface LoadingProps {
export interface LoadingProps {
showLoading?: boolean;
color?: string;
backgroundColor?: string;
}

interface ImageProps {
export interface ImageProps {
source?: string;
placeholder?: number;
resizeMode?: ResizeModeType;
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoadingDialog.tsx
Expand Up @@ -18,7 +18,7 @@ const styles = ScaledSheet.create({
// #endregion

// #region Types
interface Props {
export interface Props {
visible?: boolean;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/RadioButton.tsx
Expand Up @@ -46,7 +46,7 @@ const styles = ScaledSheet.create({
// #endregion

// #region Types
interface Props extends ViewProps {
export interface Props extends ViewProps {
text?: string;
checked?: boolean;
onPress?: () => void;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ScrollView.tsx
Expand Up @@ -8,7 +8,7 @@ import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view
import type { Theme } from 'react-native-paper/lib/typescript/types';

// #region Types
type Props = React.ComponentProps<typeof KeyboardAwareScrollView> & {
export type Props = React.ComponentProps<typeof KeyboardAwareScrollView> & {
refreshing?: boolean;
onRefresh?: () => void;
refreshColor?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/SelectDialog.tsx
Expand Up @@ -54,7 +54,7 @@ const styles = ScaledSheet.create({
// #endregion

// #region Types
interface Props {
export interface Props {
items?: SelectItem[];
selectedItems?: SelectItem[];
allowMultiSelect?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Text.tsx
Expand Up @@ -13,7 +13,7 @@ import type { Theme } from 'react-native-paper/lib/typescript/types';
import type { TextProps } from 'react-native';

// #region Types
type TextType = 'normal' | 'bold' | 'caption';
export type TextType = 'normal' | 'bold' | 'caption';

export interface Props extends TextProps {
size?: number;
Expand Down
6 changes: 3 additions & 3 deletions src/components/TextInput/Props.tsx
Expand Up @@ -3,7 +3,7 @@ import type { TextInputProps } from 'react-native-paper/lib/typescript/component
import type { Props as TextProps } from '../Text';
import type SelectItem from '../../types/SelectItem';

interface SelectProps {
export interface SelectProps {
mode?: 'dialog' | 'dropdown';
items?: SelectItem[];
selectedItems?: SelectItem[];
Expand All @@ -14,12 +14,12 @@ interface SelectProps {
closeText?: string;
}

interface ErrorProps {
export interface ErrorProps {
errorMessage?: string;
textProps?: TextProps;
}

interface TopLabelProps {
export interface TopLabelProps {
label?: string;
textProps?: TextProps;
}
Expand Down

0 comments on commit 1faaf68

Please sign in to comment.