Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions example/src/ExamplePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ const exampleCases: ExampleCase[] = [
description:
"The same 10k dynamic chat dataset rendered through Legend List.",
},
{
id: "cards-feed",
title: "Cards feed",
description:
"A mixed card feed with stories, media, polls, quotes, and events in react-native-list.",
},
{
id: "legend-list-cards-feed",
title: "Legend List cards feed",
description: "The same mixed card feed rendered through Legend List.",
},
{
id: "cards",
title: "Cards",
description:
"1k expandable card rows based on the Legend List cards example in react-native-list.",
},
{
id: "legend-list-cards",
title: "Legend List cards",
description:
"The Legend List cards example adjusted for the current Legend List API.",
},
];

export function ExamplePicker(props: {
Expand Down
87 changes: 87 additions & 0 deletions example/src/ExamplesApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import type { NativeStackScreenProps } from "@react-navigation/native-stack";
import { Text, View } from "react-native";
import { ExampleHeader } from "./components";
import { ExamplePicker } from "./ExamplePicker";
import { CardsFeedExample } from "./examples/CardsFeedExample";
import { ChatBenchmarkExample } from "./examples/ChatBenchmarkExample";
import { DynamicTextHeightsExample } from "./examples/DynamicTextHeightsExample";
import { LegendListCardsFeedExample } from "./examples/LegendListCardsFeedExample";
import { LegendListChatBenchmarkExample } from "./examples/LegendListChatBenchmarkExample";
import { LegendListCardsExample } from "./examples/LegendListCardsExample";
import { ListUpdateLabExample } from "./examples/ListUpdateLabExample";
import { CardsExample } from "./examples/CardsExample";
import { styles } from "./styles";
import type { ExampleId } from "./types";

Expand All @@ -20,6 +24,10 @@ type ExamplesStackParamList = {
DynamicTextHeightsPushStress: undefined;
ChatBenchmark: undefined;
LegendListChatBenchmark: undefined;
CardsFeed: undefined;
LegendListCardsFeed: undefined;
Cards: undefined;
LegendListCards: undefined;
};

type DynamicTextHeightsRouteParams = {
Expand Down Expand Up @@ -57,6 +65,23 @@ type LegendListChatBenchmarkScreenProps = NativeStackScreenProps<
"LegendListChatBenchmark"
>;

type CardsFeedScreenProps = NativeStackScreenProps<
ExamplesStackParamList,
"CardsFeed"
>;

type LegendListCardsFeedScreenProps = NativeStackScreenProps<
ExamplesStackParamList,
"LegendListCardsFeed"
>;

type CardsScreenProps = NativeStackScreenProps<ExamplesStackParamList, "Cards">;

type LegendListCardsScreenProps = NativeStackScreenProps<
ExamplesStackParamList,
"LegendListCards"
>;

const Stack = createNativeStackNavigator<ExamplesStackParamList>();

const screenOptions: NativeStackNavigationOptions = {
Expand Down Expand Up @@ -85,6 +110,26 @@ function ExamplePickerScreen(props: ExamplePickerScreenProps) {
return;
}

if (exampleId === "cards-feed") {
props.navigation.navigate("CardsFeed");
return;
}

if (exampleId === "legend-list-cards-feed") {
props.navigation.navigate("LegendListCardsFeed");
return;
}

if (exampleId === "cards") {
props.navigation.navigate("Cards");
return;
}

if (exampleId === "legend-list-cards") {
props.navigation.navigate("LegendListCards");
return;
}

props.navigation.navigate("DynamicTextHeights");
}

Expand Down Expand Up @@ -229,6 +274,38 @@ function LegendListChatBenchmarkScreen(
return <LegendListChatBenchmarkExample onBack={goBack} />;
}

function CardsFeedScreen(props: CardsFeedScreenProps) {
function goBack() {
props.navigation.goBack();
}

return <CardsFeedExample onBack={goBack} />;
}

function LegendListCardsFeedScreen(props: LegendListCardsFeedScreenProps) {
function goBack() {
props.navigation.goBack();
}

return <LegendListCardsFeedExample onBack={goBack} />;
}

function CardsScreen(props: CardsScreenProps) {
function goBack() {
props.navigation.goBack();
}

return <CardsExample onBack={goBack} />;
}

function LegendListCardsScreen(props: LegendListCardsScreenProps) {
function goBack() {
props.navigation.goBack();
}

return <LegendListCardsExample onBack={goBack} />;
}

export function ExamplesApp() {
return (
<NavigationContainer>
Expand All @@ -251,6 +328,16 @@ export function ExamplesApp() {
name="LegendListChatBenchmark"
component={LegendListChatBenchmarkScreen}
/>
<Stack.Screen name="CardsFeed" component={CardsFeedScreen} />
<Stack.Screen
name="LegendListCardsFeed"
component={LegendListCardsFeedScreen}
/>
<Stack.Screen name="Cards" component={CardsScreen} />
<Stack.Screen
name="LegendListCards"
component={LegendListCardsScreen}
/>
</Stack.Navigator>
</NavigationContainer>
);
Expand Down
Loading