-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSignInWithYouVersionButton.tsx
More file actions
79 lines (69 loc) · 2.16 KB
/
SignInWithYouVersionButton.tsx
File metadata and controls
79 lines (69 loc) · 2.16 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import { Host as AndroidHost } from "@expo/ui/jetpack-compose";
import { CommonViewModifierProps, Host as IosHost } from "@expo/ui/swift-ui";
import { fixedSize } from "@expo/ui/swift-ui/modifiers";
import { requireNativeView } from "expo";
import { Platform, StyleProp, ViewStyle } from "react-native";
const PlatformHost = Platform.OS === "ios" ? IosHost : AndroidHost;
const NativeView: React.ComponentType<NativeProps> = requireNativeView(
"SignInWithYouVersionButton",
);
type NativeProps = Omit<SignInWithYouVersionButtonProps, "onPress"> & {
onTap?: () => void;
} & CommonViewModifierProps;
export interface SignInWithYouVersionButtonProps {
/** Controls the width and text of the button
*
* @defaultValue "full"
*/
mode?: SignInWithYouVersionButtonMode;
/** Controls the border radius of the button
*
* @defaultValue "capsule"
*/
shape?: SignInWithYouVersionButtonShape;
/** Controls if the button is outlined
*
* @defaultValue true
*/
isStroked?: boolean;
/**
* Controls the color scheme of the button
*
* @defaultValue Uses the system color scheme
*/
colorScheme?: "light" | "dark";
/** Called when the user taps the button. You should call the signIn function in response */
onPress?: () => void;
style?: StyleProp<ViewStyle>;
}
export type SignInWithYouVersionButtonMode = "full" | "compact" | "iconOnly";
export type SignInWithYouVersionButtonShape = "capsule" | "rectangle";
/**
* A branded button for signing in with YouVersion.
* This button is a lightweight wrapper around the native YouVersion sign-in button. It contains
* localized sign-in text and the YouVersion logo.
* @param props - {@link SignInWithYouVersionButtonProps}
*/
export function SignInWithYouVersionButton({
onPress,
mode = "full",
shape = "capsule",
isStroked = true,
colorScheme,
style,
...props
}: SignInWithYouVersionButtonProps) {
return (
<PlatformHost matchContents style={style}>
<NativeView
{...props}
mode={mode}
shape={shape}
isStroked={isStroked}
colorScheme={colorScheme}
onTap={onPress}
modifiers={[fixedSize()]}
/>
</PlatformHost>
);
}