diff --git a/src/components/LibraryBottomSheet.js b/src/components/LibraryBottomSheet.js new file mode 100644 index 00000000..e69de29b diff --git a/src/screens/Library.js b/src/screens/Library.js index d07345ea..3232bab6 100644 --- a/src/screens/Library.js +++ b/src/screens/Library.js @@ -3,9 +3,10 @@ import { StyleSheet, Text, View, - ActivityIndicator, + TextInput, RefreshControl, } from "react-native"; +import { Appbar } from "react-native-paper"; import { FlatList } from "react-native-gesture-handler"; import { theme } from "../theming/theme"; import { useFocusEffect } from "@react-navigation/native"; @@ -23,6 +24,9 @@ const UpdatesScreen = ({ navigation }) => { const [refreshing, setRefreshing] = useState(false); const [novels, setNovels] = useState(); + const [searchBar, setSearchBar] = useState(false); + const [searchText, setSearchText] = useState(); + const getLibraryNovels = () => { db.transaction((tx) => { tx.executeSql( @@ -37,6 +41,20 @@ const UpdatesScreen = ({ navigation }) => { }); }; + const searchNovel = (searchText) => { + db.transaction((tx) => { + tx.executeSql( + `SELECT * FROM LibraryTable WHERE libraryStatus=1 AND novelName LIKE '%${searchText}%'`, + null, + (txObj, { rows: { _array } }) => { + setNovels(_array); + setRefreshing(false); + }, + (txObj, error) => console.log("Error ", error) + ); + }); + }; + const deleted = () => { db.transaction((tx) => { tx.executeSql( @@ -88,8 +106,65 @@ const UpdatesScreen = ({ navigation }) => { return ( <> - - + + {!searchBar ? ( + <> + + setSearchBar(true)} + color="white" + /> + _panel.show({ velocity: -1.5 })} + /> + + ) : ( + <> + { + setSearchBar(false); + setSearchText(""); + getLibraryNovels(); + }} + color={"white"} + size={24} + /> + { + setSearchText(text); + searchNovel(text); + }} + /> + {searchText !== "" && ( + { + setSearchText(""); + // getLibraryNovels(); + }} + color="white" + /> + )} + + )} + { /> } ListEmptyComponent={ - - - Σ(ಠ_ಠ) - + + Σ(ಠ_ಠ) + + + Your library is empty. Add series to your + library from Browse. + + + ) : ( - Your library is empty. Add series to your - library from Browse. + Not in library - + ) } /> {/*