Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refact(TVOS): using common example src #2173

Merged
merged 25 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f436436
chore: bump rn
alduzy May 20, 2024
4babc4d
Merge remote-tracking branch 'origin/main' into @alduzy/bump-tvosexam…
alduzy May 22, 2024
9c62a03
chore: rebuild TVOSExample
alduzy May 22, 2024
acd49b5
moved expo files to gitignore
alduzy May 22, 2024
26b073e
tv os worklfow mac os v bump
alduzy May 28, 2024
1c80e85
tv os worklfow script fix
alduzy May 28, 2024
c9e83b7
went back to using tvos own src dir
alduzy May 28, 2024
5ac1bce
using latest xcode
alduzy May 28, 2024
ab60d31
updated script
alduzy May 28, 2024
4b1ea61
try simplified script
alduzy May 28, 2024
4a4d8ca
revert try simplified script
alduzy May 28, 2024
4ef5ecc
Merge remote-tracking branch 'origin/main' into @alduzy/rebuild-tvose…
alduzy Jun 6, 2024
94ba59f
chore: podfile lock update
alduzy Jun 6, 2024
ce2a78c
refact(TVOS): using common example src
alduzy Jun 6, 2024
a3c8f3f
Merge branch 'main' into @alduzy/unify-tvosexample
alduzy Jun 10, 2024
2fc209f
fix: removed unnecessary workflow step
alduzy Jun 10, 2024
411907d
refact: newline
alduzy Jun 10, 2024
c7d389a
added Platform ternary for TVOS example
alduzy Jun 10, 2024
4d12007
refact: simplified examples and playgrounds
alduzy Jun 11, 2024
1e5856e
refact: platform check adjusted
alduzy Jun 11, 2024
5654ac0
refact: less nesting
alduzy Jun 11, 2024
dfd02db
Merge remote-tracking branch 'origin/main' into @alduzy/unify-tvosexa…
alduzy Jun 11, 2024
3ada82c
refact: extending root tsconfig
alduzy Jun 11, 2024
fabecad
feat: changing title icon based on platform
alduzy Jun 11, 2024
aada1aa
feat: disabling instead of hiding N/A screens
alduzy Jun 11, 2024
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
27 changes: 2 additions & 25 deletions TVOSExample/App.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import HomeScreen from './src/HomeScreen';
import BottomTabsExample from './src/BottomTabsExample';
import ModalsExample from './src/ModalsExample';
import NativeStackExample from './src/NativeStackExample';
import App from '../apps/examples';

const Stack = createNativeStackNavigator();

export default function App() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="Home"
component={HomeScreen}
options={{ title: '📺 React Native Screens' }}
/>
<Stack.Screen name="Bottom Tabs" component={BottomTabsExample} />
<Stack.Screen name="Modals" component={ModalsExample} />
<Stack.Screen name="Native Stack" component={NativeStackExample} />
</Stack.Navigator>
</NavigationContainer>
);
}
export default App;
40 changes: 0 additions & 40 deletions TVOSExample/src/BottomTabsExample.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions TVOSExample/src/HomeScreen.tsx

This file was deleted.

72 changes: 0 additions & 72 deletions TVOSExample/src/ModalsExample.tsx

This file was deleted.

54 changes: 0 additions & 54 deletions TVOSExample/src/NativeStackExample.tsx

This file was deleted.

1 change: 0 additions & 1 deletion TVOSExample/src/examples.ts

This file was deleted.

9 changes: 0 additions & 9 deletions TVOSExample/src/styles.ts

This file was deleted.

37 changes: 25 additions & 12 deletions apps/examples/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ const SCREENS: Record<
title: string;
component: () => React.JSX.Element;
type: 'example' | 'playground';
isTVOSready?: boolean;
}
> = {
SimpleNativeStack: {
title: 'Simple Native Stack',
component: SimpleNativeStack,
type: 'example',
isTVOSready: true,
},
SwipeBackAnimation: {
title: 'Swipe Back Animation',
Expand All @@ -59,16 +61,19 @@ const SCREENS: Record<
title: 'Stack Presentation',
component: StackPresentation,
type: 'example',
isTVOSready: true,
},
BottomTabsAndStack: {
title: 'Bottom tabs and native stack',
component: BottomTabsAndStack,
type: 'example',
isTVOSready: true,
},
Modals: {
title: 'Modals',
component: Modals,
type: 'example',
isTVOSready: true,
},
HeaderOptions: {
title: 'Header Options',
Expand Down Expand Up @@ -107,6 +112,10 @@ const SCREENS: Record<
},
};

const screens = Object.keys(SCREENS).filter(
name => !Platform.isTV || !!SCREENS[name].isTVOSready
alduzy marked this conversation as resolved.
Show resolved Hide resolved
);

type RootStackParamList = {
Main: undefined;
} & {
Expand All @@ -133,7 +142,7 @@ const MainScreen = ({ navigation }: MainScreenProps): React.JSX.Element => (
<Text style={styles.label} testID="root-screen-examples-header">
alduzy marked this conversation as resolved.
Show resolved Hide resolved
Examples
</Text>
{Object.keys(SCREENS)
{screens
.filter(name => SCREENS[name].type === 'example')
.map(name => (
<ListItem
Expand All @@ -143,17 +152,21 @@ const MainScreen = ({ navigation }: MainScreenProps): React.JSX.Element => (
onPress={() => navigation.navigate(name)}
/>
))}
<Text style={styles.label}>Playgrounds</Text>
{Object.keys(SCREENS)
.filter(name => SCREENS[name].type === 'playground')
.map(name => (
<ListItem
key={name}
testID={`root-screen-playground-${name}`}
title={SCREENS[name].title}
onPress={() => navigation.navigate(name)}
/>
))}
{!Platform.isTV && (
alduzy marked this conversation as resolved.
Show resolved Hide resolved
<>
<Text style={styles.label}>Playgrounds</Text>
{screens
.filter(name => SCREENS[name].type === 'playground')
.map(name => (
<ListItem
key={name}
testID={`root-screen-playground-${name}`}
title={SCREENS[name].title}
onPress={() => navigation.navigate(name)}
/>
))}
</>
)}
</ScrollView>
);

Expand Down
Loading