mirror of
https://github.com/movie-web/native-app.git
synced 2025-09-13 16:33:26 +00:00
feat: restructure internal tab stuff to make more sense
This commit is contained in:
@@ -9,7 +9,7 @@ import Colors from "@movie-web/tailwind-config/colors";
|
|||||||
import { MovieWebSvg } from "~/components/Icon";
|
import { MovieWebSvg } from "~/components/Icon";
|
||||||
import SvgTabBarIcon from "~/components/SvgTabBarIcon";
|
import SvgTabBarIcon from "~/components/SvgTabBarIcon";
|
||||||
import TabBarIcon from "~/components/TabBarIcon";
|
import TabBarIcon from "~/components/TabBarIcon";
|
||||||
import SearchTabContext from "./search/SearchTabContext";
|
import SearchTabContext from "../../components/ui/SearchTabContext";
|
||||||
|
|
||||||
export default function TabLayout() {
|
export default function TabLayout() {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
@@ -79,7 +79,7 @@ export default function TabLayout() {
|
|||||||
<Tabs.Screen
|
<Tabs.Screen
|
||||||
name="search"
|
name="search"
|
||||||
options={{
|
options={{
|
||||||
title: "Search",
|
title: "Home",
|
||||||
tabBarLabel: "",
|
tabBarLabel: "",
|
||||||
tabBarIcon: ({ focused }) => (
|
tabBarIcon: ({ focused }) => (
|
||||||
<View
|
<View
|
||||||
|
@@ -1,51 +1,7 @@
|
|||||||
import { ScrollView, View } from "react-native";
|
import React from "react";
|
||||||
import { useSharedValue, withTiming } from "react-native-reanimated";
|
|
||||||
|
|
||||||
import {
|
import HomeScreenContent from "~/components/HomeScreenContent";
|
||||||
bookmarks,
|
|
||||||
ItemListSection,
|
|
||||||
watching,
|
|
||||||
} from "~/components/item/ItemListSection";
|
|
||||||
import ScreenLayout from "~/components/layout/ScreenLayout";
|
|
||||||
import { Text } from "~/components/ui/Text";
|
|
||||||
|
|
||||||
export default function HomeScreen() {
|
export default function HomeScreen() {
|
||||||
const fadeAnim = useSharedValue(1);
|
return <HomeScreenContent />;
|
||||||
|
|
||||||
const handleScrollBegin = () => {
|
|
||||||
fadeAnim.value = withTiming(0, {
|
|
||||||
duration: 100,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleScrollEnd = () => {
|
|
||||||
fadeAnim.value = withTiming(1, {
|
|
||||||
duration: 100,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View style={{ flex: 1 }}>
|
|
||||||
<ScrollView
|
|
||||||
onScrollBeginDrag={handleScrollBegin}
|
|
||||||
onMomentumScrollEnd={handleScrollEnd}
|
|
||||||
scrollEnabled={
|
|
||||||
bookmarks.length > 0 || watching.length > 0 ? true : false
|
|
||||||
}
|
|
||||||
keyboardDismissMode="on-drag"
|
|
||||||
keyboardShouldPersistTaps="handled"
|
|
||||||
>
|
|
||||||
<ScreenLayout
|
|
||||||
title={
|
|
||||||
<View className="flex-row items-center">
|
|
||||||
<Text className="text-2xl font-bold">Home</Text>
|
|
||||||
</View>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<ItemListSection title="Bookmarks" items={bookmarks} />
|
|
||||||
<ItemListSection title="Continue Watching" items={watching} />
|
|
||||||
</ScreenLayout>
|
|
||||||
</ScrollView>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
7
apps/expo/src/app/(tabs)/search.tsx
Normal file
7
apps/expo/src/app/(tabs)/search.tsx
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
import HomeScreenContent from "~/components/HomeScreenContent";
|
||||||
|
|
||||||
|
export default function SearchScreen() {
|
||||||
|
return <HomeScreenContent />;
|
||||||
|
}
|
@@ -18,10 +18,10 @@ import {
|
|||||||
watching,
|
watching,
|
||||||
} from "~/components/item/ItemListSection";
|
} from "~/components/item/ItemListSection";
|
||||||
import ScreenLayout from "~/components/layout/ScreenLayout";
|
import ScreenLayout from "~/components/layout/ScreenLayout";
|
||||||
|
import { SearchBar } from "~/components/ui/Searchbar";
|
||||||
import { Text } from "~/components/ui/Text";
|
import { Text } from "~/components/ui/Text";
|
||||||
import Searchbar from "./Searchbar";
|
|
||||||
|
|
||||||
export default function SearchScreen() {
|
export default function HomeScreenContent() {
|
||||||
const [query, setQuery] = useState("");
|
const [query, setQuery] = useState("");
|
||||||
const translateY = useSharedValue(0);
|
const translateY = useSharedValue(0);
|
||||||
const fadeAnim = useSharedValue(1);
|
const fadeAnim = useSharedValue(1);
|
||||||
@@ -146,7 +146,7 @@ export default function SearchScreen() {
|
|||||||
animatedStyle,
|
animatedStyle,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Searchbar onSearchChange={setQuery} />
|
<SearchBar onSearchChange={setQuery} />
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
@@ -7,7 +7,7 @@ import Colors from "@movie-web/tailwind-config/colors";
|
|||||||
|
|
||||||
import SearchTabContext from "./SearchTabContext";
|
import SearchTabContext from "./SearchTabContext";
|
||||||
|
|
||||||
export default function Searchbar({
|
export function SearchBar({
|
||||||
onSearchChange,
|
onSearchChange,
|
||||||
}: {
|
}: {
|
||||||
onSearchChange: (text: string) => void;
|
onSearchChange: (text: string) => void;
|
Reference in New Issue
Block a user