Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Button onPress optional #22

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/components.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import {
ActivityIndicator as _ActivityIndicator,
Button as _Button,
DatePickerIOS as _DatePickerIOS,
DrawerLayoutAndroid as _DrawerLayoutAndroid,
FlatList as _FlatList,
Image as _Image,
InputAccessoryView as _InputAccessoryView,
KeyboardAvoidingView as _KeyboardAvoidingView,
MaskedViewIOS as _MaskedViewIOS,
Modal as _Modal,
NavigatorIOS as _NavigatorIOS,
RefreshControl as _RefreshControl,
Expand All @@ -19,35 +17,33 @@ import {
TabBarIOS as _TabBarIOS,
TextInput as _TextInput,
Text as _Text,
ToolbarAndroid as _ToolbarAndroid,
TouchableHighlight as _TouchableHighlight,
TouchableNativeFeedback as _TouchableNativeFeedback,
TouchableOpacity as _TouchableOpacity,
TouchableWithoutFeedback as _TouchableWithoutFeedback,
View as _View,
ButtonProps,
} from 'react-native';
import {makeHelper} from './helper';

type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;

export const ActivityIndicator = makeHelper(_ActivityIndicator);
export const Button = makeHelper(_Button);
export const Button = makeHelper<Optional<ButtonProps, 'onPress'>>(_Button);
export const DrawerLayoutAndroid = makeHelper(_DrawerLayoutAndroid);
export const FlatList = makeHelper(_FlatList);
export const Image = makeHelper(_Image);
export const InputAccessoryView = makeHelper(_InputAccessoryView);
export const KeyboardAvoidingView = makeHelper(_KeyboardAvoidingView);
export const MaskedViewIOS = makeHelper(_MaskedViewIOS);
export const Modal = makeHelper(_Modal);
export const NavigatorIOS = makeHelper(_NavigatorIOS);
export const RefreshControl = makeHelper(_RefreshControl);
export const ScrollView = makeHelper(_ScrollView);
export const SectionList = makeHelper(_SectionList);
export const SnapshotViewIOS = makeHelper(_SnapshotViewIOS);
export const StatusBar = makeHelper(_StatusBar);
export const Switch = makeHelper(_Switch);
export const TabBarIOS = makeHelper(_TabBarIOS);
export const TextInput = makeHelper(_TextInput);
export const Text = makeHelper(_Text);
export const ToolbarAndroid = makeHelper(_ToolbarAndroid);
export const TouchableHighlight = makeHelper(_TouchableHighlight);
export const TouchableNativeFeedback = makeHelper(_TouchableNativeFeedback);
export const TouchableOpacity = makeHelper(_TouchableOpacity);
Expand Down