import React from "react"; import { FlatList, View } from "react-native"; import { Button, Chip, Text } from "react-native-paper"; import { useNavigation } from "@react-navigation/native"; import { BIBLE_BOOKS, getBookChapterCount } from "../utils/bibleReferences.js"; import i18n from "../i18nMessages.js"; const Bible = () => { const navigation = useNavigation(); const [selectedBook, setSelectedBook] = React.useState(""); const [activeStep, setActiveStep] = React.useState("book"); const selectedBookChapterCount = React.useMemo(() => getBookChapterCount(selectedBook), [selectedBook]); const chapterOptions = React.useMemo( () => Array.from({ length: selectedBookChapterCount }, (_v, i) => String(i + 1)), [selectedBookChapterCount] ); return ( {i18n.t("message.bible") || "Read the Bible"} {i18n.t("message.biblePickerSubtitlePost") || "Select a book and chapter to start reading."} {activeStep === "book" ? ( <> {i18n.t("message.books") || "Books"} item} renderItem={({ item }) => ( { setSelectedBook(item); setActiveStep("chapter"); }} > {item} )} /> ) : null} {activeStep === "chapter" ? ( <> {i18n.t("message.chapters") || "Chapters"} {selectedBook ? `(${selectedBook})` : ""} item} renderItem={({ item }) => ( { navigation.navigate("BibleChapter", { reference: `${selectedBook} ${item}`, selectable: false }); }} > {item} )} /> ) : null} ); }; export default Bible;