diff --git a/src/Screens/Browse/GlobalSearch.js b/src/Screens/Browse/GlobalSearch.js index 63added4..3de1a2ce 100644 --- a/src/Screens/Browse/GlobalSearch.js +++ b/src/Screens/Browse/GlobalSearch.js @@ -17,11 +17,16 @@ import GlobalSearchNovelList from "./components/GlobalSearchNovelList"; import { ProgressBar } from "react-native-paper"; import { showToast } from "../../Hooks/showToast"; -const GlobalSearch = ({ navigation }) => { +const GlobalSearch = ({ route, navigation }) => { const theme = useTheme(); + let novelName; + + if (route.params) { + novelName = route.params.novelName; + } const [loading, setLoading] = useState(false); - const [searchText, setSearchText] = useState(""); + const [searchText, setSearchText] = useState(novelName); const [searchResults, setSearchResults] = useState(""); const { sources, pinned } = useSelector((state) => state.sourceReducer); const [progress, setProgress] = useState(0); @@ -32,6 +37,10 @@ const GlobalSearch = ({ navigation }) => { (source) => pinned.indexOf(source.sourceId) !== -1 ); + useEffect(() => { + novelName && onSubmitEditing(); + }, []); + const clearSearchbar = () => { setSearchText(""); }; diff --git a/src/Screens/Library/Library.js b/src/Screens/Library/Library.js index a8572426..6545dbeb 100644 --- a/src/Screens/Library/Library.js +++ b/src/Screens/Library/Library.js @@ -5,6 +5,7 @@ import { View, RefreshControl, ActivityIndicator, + TouchableOpacity, } from "react-native"; import { useFocusEffect } from "@react-navigation/native"; import { useSelector, useDispatch } from "react-redux"; @@ -21,7 +22,7 @@ import { import { updateLibraryAction } from "../../redux/updates/updates.actions"; import { useSettings, useTheme } from "../../Hooks/reduxHooks"; import { setNovel } from "../../redux/novel/novel.actions"; -import { Portal } from "react-native-paper"; +import { Portal, TouchableRipple } from "react-native-paper"; import LibraryFilterSheet from "./components/LibraryFilterSheet"; const LibraryScreen = ({ navigation }) => { @@ -88,9 +89,20 @@ const LibraryScreen = ({ navigation }) => { const listEmptyComponent = () => searchText !== "" ? ( - - {`"${searchText}" not in library`} - + + navigation.navigate("GlobalSearch", { + novelName: searchText, + }) + } + borderless + rippleColor={theme.colorAccent} + style={styles.emptySearch} + > + + {`Search for "${searchText}" globally`} + + ) : ( { >