[@types/react-native-actionsheet] Add missing ActionSheetCustom (#37240)

* [@types/react-native-actionsheet] Add missing ActionSheetCustom

* Add missing buttonUnderlayColor
This commit is contained in:
Krister Kari 2019-08-01 22:38:05 +03:00 committed by Jesse Trinity
parent 7befb82fde
commit 0278a498f7
2 changed files with 41 additions and 2 deletions

View File

@ -7,16 +7,31 @@
import * as React from 'react';
export interface ActionSheetProps {
options: React.ReactNode[];
options: string[];
onPress: (index: number) => void;
title?: string;
message?: string;
tintColor?: string;
cancelButtonIndex?: number;
destructiveButtonIndex?: number;
}
export interface ActionSheetCustomProps {
options: React.ReactNode[];
onPress: (index: number) => void;
title?: React.ReactNode;
message?: string;
tintColor?: string;
buttonUnderlayColor?: string;
cancelButtonIndex?: number;
destructiveButtonIndex?: number;
styles?: object;
}
export default class ActionSheet extends React.Component<ActionSheetProps> {
show: () => void;
}
export class ActionSheetCustom extends React.Component<ActionSheetCustomProps> {
show: () => void;
}

View File

@ -1,5 +1,6 @@
import * as React from 'react';
import ActionSheet from 'react-native-actionsheet';
import { Text } from 'react-native';
import ActionSheet, { ActionSheetCustom } from 'react-native-actionsheet';
class Example extends React.Component {
render() {
@ -12,6 +13,29 @@ class Example extends React.Component {
tintColor="white"
cancelButtonIndex={0}
destructiveButtonIndex={1}
/>
);
}
}
class CustomSheetExample extends React.Component {
render() {
return (
<ActionSheetCustom
options={[
'Cancel',
'Apple',
<Text style={{ color: 'yellow' }}>Banana</Text>,
'Watermelon',
<Text style={{ color: 'red' }}>Durian</Text>,
]}
onPress={index => {}}
title={<Text style={{ color: '#000', fontSize: 18 }}>Which one do you like?</Text>}
message="Test"
tintColor="white"
buttonUnderlayColor="rebeccapurple"
cancelButtonIndex={0}
destructiveButtonIndex={1}
styles={{}}
/>
);