forked from Gustash/react-native-siri-shortcut
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddToSiriButton.js
58 lines (50 loc) · 1.08 KB
/
AddToSiriButton.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// @flow
import type { ShortcutOptions } from ".";
import * as React from "react";
import {
requireNativeComponent,
View,
StyleSheet,
Platform
} from "react-native";
const RNTAddToSiriButton = requireNativeComponent("RNTAddToSiriButton");
export const SiriButtonStyles = {
white: 0,
whiteOutline: 1,
black: 2,
blackOutline: 3
};
type ViewProps = React.ElementConfig<typeof View>;
type ViewStyleProp = $PropertyType<ViewProps, "style">;
type Props = {
buttonStyle?: 0 | 1 | 2 | 3,
style?: ViewStyleProp,
shortcut: ShortcutOptions,
onPress?: () => void
};
export const supportsSiriButton =
Platform.OS === "ios" && Number.parseFloat(Platform.Version, 10) >= 12;
const AddToSiriButton = ({
buttonStyle = SiriButtonStyles.white,
style = {},
onPress = () => {},
shortcut
}: Props) => (
<View
style={[
{
width: 149,
height: 50
},
style
]}
>
<RNTAddToSiriButton
buttonStyle={buttonStyle}
style={{ flex: 1 }}
onPress={onPress}
shortcut={shortcut}
/>
</View>
);
export default AddToSiriButton;