Skip to content

Commit

Permalink
fix: type annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
miyasan31 committed Aug 19, 2023
1 parent d055757 commit c56d3ad
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 40 deletions.
8 changes: 5 additions & 3 deletions src/ui/animations/Bounceable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ForwardedRef, forwardRef, memo, ReactNode } from 'react';
import React, { ForwardedRef, forwardRef, ReactNode, Ref } from 'react';
import type {
PressableStateCallbackType,
View as NativeView,
Expand Down Expand Up @@ -106,6 +106,8 @@ const BounceableComponent = (
);
};

export const Bounceable = memo(
forwardRef<NativeView, BounceableProps>(BounceableComponent)
export const Bounceable: (
props: { ref?: Ref<NativeView> } & BounceableProps
) => JSX.Element | null = forwardRef<NativeView, BounceableProps>(
BounceableComponent
);
8 changes: 4 additions & 4 deletions src/ui/elements/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, {
ForwardedRef,
forwardRef,
memo,
ReactElement,
ReactNode,
Ref,
} from 'react';
import type { View as NativeView } from 'react-native';
import type {
Expand Down Expand Up @@ -163,6 +163,6 @@ const lgStyle = createAreniteStyle({
},
});

export const Button = memo(
forwardRef<NativeView, ButtonProps>(ButtonComponent)
);
export const Button: (
props: { ref?: Ref<NativeView> } & ButtonProps
) => JSX.Element | null = forwardRef<NativeView, ButtonProps>(ButtonComponent);
4 changes: 3 additions & 1 deletion src/ui/elements/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,6 @@ const lgRadiusStyle = {

ButtonGroupComponent.displayName = 'arenite-kit.ui.ButtonGroup';

export const ButtonGroup = ButtonGroupComponent;
export const ButtonGroup: <T>(
props: ButtonGroupProps<T>
) => JSX.Element | null = ButtonGroupComponent;
4 changes: 2 additions & 2 deletions src/ui/elements/Divider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { memo } from 'react';
import React from 'react';
import type { BorderThemeProps, ColorThemeProps } from '../../core';
import { createAreniteStyle } from '../../style';
import { Text, Box } from '../primitives';
Expand Down Expand Up @@ -65,4 +65,4 @@ const defaultStyle = createAreniteStyle({
},
});

export const Divider = memo(DividerComponent);
export const Divider = DividerComponent;
8 changes: 4 additions & 4 deletions src/ui/elements/HStack.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ForwardedRef, forwardRef, memo } from 'react';
import React, { ForwardedRef, forwardRef, Ref } from 'react';
import type { View as NativeView } from 'react-native';
import { createAreniteStyle } from '../../style';
import type { AreniteViewStyle } from '../../style';
Expand Down Expand Up @@ -37,6 +37,6 @@ const defaultStyle = createAreniteStyle({
},
});

export const HStack = memo(
forwardRef<NativeView, HStackProps>(HStackComponent)
);
export const HStack: (
props: { ref?: Ref<NativeView> } & HStackProps
) => JSX.Element | null = forwardRef<NativeView, HStackProps>(HStackComponent);
8 changes: 5 additions & 3 deletions src/ui/elements/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ForwardedRef, forwardRef, memo, ReactNode } from 'react';
import React, { ForwardedRef, forwardRef, ReactNode, Ref } from 'react';
import type { View as NativeView } from 'react-native';
import type { BgThemeProps, BorderThemeProps, SizeKeys } from '../../core';
import { createAreniteStyle } from '../../style';
Expand Down Expand Up @@ -83,6 +83,8 @@ const defaultStyle = createAreniteStyle({
},
});

export const IconButton = memo(
forwardRef<NativeView, IconButtonProps>(IconButtonComponent)
export const IconButton: (
props: { ref?: Ref<NativeView> } & IconButtonProps
) => JSX.Element | null = forwardRef<NativeView, IconButtonProps>(
IconButtonComponent
);
8 changes: 4 additions & 4 deletions src/ui/elements/VStack.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ForwardedRef, forwardRef, memo } from 'react';
import React, { ForwardedRef, forwardRef, Ref } from 'react';
import type { View as NativeView } from 'react-native';
import { createAreniteStyle } from '../../style';
import type { AreniteViewStyle } from '../../style';
Expand Down Expand Up @@ -37,6 +37,6 @@ const defaultStyle = createAreniteStyle({
},
});

export const VStack = memo(
forwardRef<NativeView, VStackProps>(VStackComponent)
);
export const VStack: (
props: { ref?: Ref<NativeView> } & VStackProps
) => JSX.Element | null = forwardRef<NativeView, VStackProps>(VStackComponent);
6 changes: 4 additions & 2 deletions src/ui/primitives/ActivityIndicator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ForwardedRef, forwardRef, memo } from 'react';
import React, { ForwardedRef, forwardRef, memo, Ref } from 'react';
import { ActivityIndicator as NativeActivityIndicator } from 'react-native';
import type { CommonToken } from '../../core';
import { BgThemeProps, BorderThemeProps, usePaletteColor } from '../../core';
Expand Down Expand Up @@ -50,7 +50,9 @@ const ActivityIndicatorComponent = (
);
};

export const ActivityIndicator = memo(
export const ActivityIndicator: (
props: { ref?: Ref<NativeActivityIndicator> } & ActivityIndicatorProps
) => JSX.Element | null = memo(
forwardRef<NativeActivityIndicator, ActivityIndicatorProps>(
ActivityIndicatorComponent
)
Expand Down
6 changes: 4 additions & 2 deletions src/ui/primitives/Box.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ForwardedRef, forwardRef, memo } from 'react';
import React, { ForwardedRef, forwardRef, Ref } from 'react';
import { View as NativeView } from 'react-native';
import type { BgThemeProps, BorderThemeProps } from '../../core';
import { usePaletteColor } from '../../core';
Expand Down Expand Up @@ -43,4 +43,6 @@ const BoxComponent = (props: BoxProps, ref: ForwardedRef<NativeView>) => {
);
};

export const Box = memo(forwardRef<NativeView, BoxProps>(BoxComponent));
export const Box: (
props: { ref?: Ref<NativeView> } & BoxProps
) => JSX.Element | null = forwardRef<NativeView, BoxProps>(BoxComponent);
6 changes: 4 additions & 2 deletions src/ui/primitives/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ForwardedRef, forwardRef, memo } from 'react';
import React, { ForwardedRef, forwardRef, Ref } from 'react';
import { Image as NativeImage } from 'react-native';
import { usePaletteColor } from '../../core';
import type { BgThemeProps, BorderThemeProps } from '../../core';
Expand Down Expand Up @@ -47,4 +47,6 @@ const ImageComponent = (props: ImageProps, ref: ForwardedRef<NativeImage>) => {
);
};

export const Image = memo(forwardRef<NativeImage, ImageProps>(ImageComponent));
export const Image: (
props: { ref?: Ref<NativeImage> } & ImageProps
) => JSX.Element | null = forwardRef<NativeImage, ImageProps>(ImageComponent);
8 changes: 5 additions & 3 deletions src/ui/primitives/Pressable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ForwardedRef, forwardRef, memo } from 'react';
import React, { ForwardedRef, forwardRef, Ref } from 'react';
import {
View as NativeView,
Pressable as NativePressable,
Expand Down Expand Up @@ -59,6 +59,8 @@ const PressableComponent = (
);
};

export const Pressable = memo(
forwardRef<NativeView, PressableProps>(PressableComponent)
export const Pressable: (
props: { ref?: Ref<NativeView> } & PressableProps
) => JSX.Element | null = forwardRef<NativeView, PressableProps>(
PressableComponent
);
5 changes: 3 additions & 2 deletions src/ui/primitives/SafeAreaView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { memo } from 'react';
import React from 'react';
import type { NativeSafeAreaViewProps } from 'react-native-safe-area-context';
import { SafeAreaView as NativeSafeAreaView } from 'react-native-safe-area-context';
import type { BgThemeProps } from '../../core';
Expand Down Expand Up @@ -42,4 +42,5 @@ const defaultStyle = createAreniteStyle({
},
});

export const SafeAreaView = memo(SafeAreaViewComponent);
export const SafeAreaView: (props: SafeAreaViewProps) => JSX.Element | null =
SafeAreaViewComponent;
8 changes: 5 additions & 3 deletions src/ui/primitives/ScrollView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ForwardedRef, forwardRef, memo } from 'react';
import React, { ForwardedRef, forwardRef, Ref } from 'react';
import { ScrollView as NativeScrollView } from 'react-native';
import type { BgThemeProps, BorderThemeProps } from '../../core';
import { usePaletteColor } from '../../core';
Expand Down Expand Up @@ -46,6 +46,8 @@ const ScrollViewComponent = (
);
};

export const ScrollView = memo(
forwardRef<NativeScrollView, ScrollViewProps>(ScrollViewComponent)
export const ScrollView: (
props: { ref?: Ref<NativeScrollView> } & ScrollViewProps
) => JSX.Element | null = forwardRef<NativeScrollView, ScrollViewProps>(
ScrollViewComponent
);
6 changes: 4 additions & 2 deletions src/ui/primitives/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ForwardedRef, forwardRef, memo } from 'react';
import React, { ForwardedRef, forwardRef, Ref } from 'react';
import { Text as NativeText } from 'react-native';
import type { ColorThemeProps } from '../../core';
import { usePaletteColor } from '../../core';
Expand Down Expand Up @@ -28,4 +28,6 @@ const TextComponent = (props: TextProps, ref: ForwardedRef<NativeText>) => {
return <NativeText ref={ref} style={[style, { color }]} {...otherProps} />;
};

export const Text = memo(forwardRef<NativeText, TextProps>(TextComponent));
export const Text: (
props: { ref?: Ref<NativeText> } & TextProps
) => JSX.Element | null = forwardRef<NativeText, TextProps>(TextComponent);
8 changes: 5 additions & 3 deletions src/ui/primitives/TextInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ForwardedRef, forwardRef, memo } from 'react';
import React, { ForwardedRef, forwardRef, Ref } from 'react';
import { TextInput as NativeTextInput } from 'react-native';
import type {
BgThemeProps,
Expand Down Expand Up @@ -81,6 +81,8 @@ const defaultStyle = createAreniteStyle({
},
});

export const TextInput = memo(
forwardRef<NativeTextInput, TextInputProps>(TextInputComponent)
export const TextInput: (
props: { ref?: Ref<NativeTextInput> } & TextInputProps
) => JSX.Element | null = forwardRef<NativeTextInput, TextInputProps>(
TextInputComponent
);

0 comments on commit c56d3ad

Please sign in to comment.