-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBibleReaderView.tsx
More file actions
56 lines (47 loc) · 1.76 KB
/
BibleReaderView.tsx
File metadata and controls
56 lines (47 loc) · 1.76 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
import { Host as AndroidHost } from "@expo/ui/jetpack-compose";
import { Host as IosHost } from "@expo/ui/swift-ui";
import { requireNativeView } from "expo";
import { Platform, StyleSheet } from "react-native";
import { BibleReference } from "../types";
const NativeView: React.ComponentType<NativeProps> =
requireNativeView("BibleReaderView");
const PlatformHost = Platform.OS === "ios" ? IosHost : AndroidHost;
/**
* A full-featured Bible reader component.
* It allows the user to control font customizations, switch Bible versions and access their verse highlights.
* It is designed after the YouVersion Bible reader experience found in the YouVersion app.
* @param props - {@link BibleReaderViewProps}
*/
export function BibleReaderView({ reference, ...props }: BibleReaderViewProps) {
return (
<PlatformHost style={styles.view}>
<NativeView
hasReference={!!reference}
{...(reference || {})}
{...props}
/>
</PlatformHost>
);
}
const styles = StyleSheet.create({
view: {
flex: 1,
},
});
export interface BibleReaderViewProps {
/** A reference to a passage in the Bible the reader should open to. This could be a single verse, a range of verses or the entire chapter */
reference?: BibleReference | null | undefined;
/**
* Name of your app.
* The SDK will use this in various places when prompting the user to sign in to their YouVersion account. This will let the user know which app is requesting their information.
*/
appName: string;
/**
* A custom message to display to the user from the sign-in sheet, letting them know why they should sign in.
*/
signInMessage: string;
}
type NativeProps = Omit<BibleReaderViewProps, "reference"> &
Partial<BibleReference> & {
hasReference: boolean;
};