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

chore: Implement missing codegen interfaces #2153

Closed
Closed
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
2 changes: 2 additions & 0 deletions .github/workflows/android-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
cache: 'yarn'
- name: Install root node dependencies
run: yarn install && yarn submodules
- name: Install shared app dependencies
run: (cd app && yarn install)
- name: Install node dependencies
id: install_deps
working-directory: ${{ env.WORKING_DIRECTORY }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ios-e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
run: brew tap wix/brew && brew install applesimutils
- name: Install root node dependencies
run: yarn install && yarn submodules
- name: Install shared app dependencies
run: (cd app && yarn install)
- name: Install node dependencies
working-directory: ${{ env.WORKING_DIRECTORY }}
run: yarn
Expand Down
197 changes: 2 additions & 195 deletions Example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,196 +1,3 @@
import React from 'react';
import {
ScrollView,
StyleSheet,
Text,
I18nManager,
Platform,
StatusBar,
} from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { StackNavigationProp } from '@react-navigation/stack';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import RNRestart from 'react-native-restart';
import App from '../app';

import { ListItem, SettingsSwitch } from './src/shared';

import SimpleNativeStack from './src/screens/SimpleNativeStack';
import SwipeBackAnimation from './src/screens/SwipeBackAnimation';
import StackPresentation from './src/screens/StackPresentation';
import HeaderOptions from './src/screens/HeaderOptions';
import StatusBarExample from './src/screens/StatusBar';
import Animations from './src/screens/Animations';
import BottomTabsAndStack from './src/screens/BottomTabsAndStack';
import Modals from './src/screens/Modals';
import Orientation from './src/screens/Orientation';
import SearchBar from './src/screens/SearchBar';
import Events from './src/screens/Events';
import Gestures from './src/screens/Gestures';

import { enableFreeze } from 'react-native-screens';
import { GestureDetectorProvider } from 'react-native-screens/gesture-handler';
import { GestureHandlerRootView } from 'react-native-gesture-handler';

enableFreeze();

if (Platform.OS === 'android') {
StatusBar.setTranslucent(true);
}

const SCREENS: Record<
string,
{
title: string;
component: () => React.JSX.Element;
type: 'example' | 'playground';
}
> = {
SimpleNativeStack: {
title: 'Simple Native Stack',
component: SimpleNativeStack,
type: 'example',
},
SwipeBackAnimation: {
title: 'Swipe Back Animation',
component: SwipeBackAnimation,
type: 'example',
},
StackPresentation: {
title: 'Stack Presentation',
component: StackPresentation,
type: 'example',
},
BottomTabsAndStack: {
title: 'Bottom tabs and native stack',
component: BottomTabsAndStack,
type: 'example',
},
Modals: {
title: 'Modals',
component: Modals,
type: 'example',
},
HeaderOptions: {
title: 'Header Options',
component: HeaderOptions,
type: 'playground',
},
StatusBar: {
title: 'Status bar',
component: StatusBarExample,
type: 'playground',
},
Animations: {
title: 'Animations',
component: Animations,
type: 'playground',
},
Orientation: {
title: 'Orientation',
component: Orientation,
type: 'playground',
},
SearchBar: {
title: 'Search bar',
component: SearchBar,
type: 'playground',
},
Events: {
title: 'Events',
component: Events,
type: 'playground',
},
Gestures: {
title: 'Gestures',
component: Gestures,
type: 'playground',
},
};

type RootStackParamList = {
Main: undefined;
} & {
[P in keyof typeof SCREENS]: undefined;
};

const Stack = createNativeStackNavigator<RootStackParamList>();

interface MainScreenProps {
navigation: StackNavigationProp<RootStackParamList, 'Main'>;
}

const MainScreen = ({ navigation }: MainScreenProps): React.JSX.Element => (
<ScrollView testID="root-screen-examples-scrollview">
<SettingsSwitch
style={styles.switch}
label="Right to left"
value={I18nManager.isRTL}
onValueChange={() => {
I18nManager.forceRTL(!I18nManager.isRTL);
RNRestart.Restart();
}}
/>
<Text style={styles.label} testID="root-screen-examples-header">
Examples
</Text>
{Object.keys(SCREENS)
.filter(name => SCREENS[name].type === 'example')
.map(name => (
<ListItem
key={name}
testID={`root-screen-example-${name}`}
title={SCREENS[name].title}
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)}
/>
))}
</ScrollView>
);

const ExampleApp = (): React.JSX.Element => (
<GestureHandlerRootView style={{ flex: 1 }}>
<GestureDetectorProvider>
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="Main"
options={{ title: '📱 React Native Screens Examples' }}
component={MainScreen}
/>
{Object.keys(SCREENS).map(name => (
<Stack.Screen
key={name}
name={name}
getComponent={() => SCREENS[name].component}
options={{ headerShown: false }}
/>
))}
</Stack.Navigator>
</NavigationContainer>
</GestureDetectorProvider>
</GestureHandlerRootView>
);

const styles = StyleSheet.create({
label: {
fontSize: 15,
color: 'black',
margin: 10,
marginTop: 15,
},
switch: {
marginTop: 15,
},
});

export default ExampleApp;
export default App;
43 changes: 0 additions & 43 deletions FabricExample/App.js

This file was deleted.

3 changes: 3 additions & 0 deletions FabricExample/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import App from '../app';

export default App;
6 changes: 5 additions & 1 deletion FabricExample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
"@react-navigation/native-stack": "link:../react-navigation/packages/native-stack/",
"@react-navigation/routers": "link:../react-navigation/packages/routers/",
"@react-navigation/stack": "link:../react-navigation/packages/stack/",
"nanoid": "^4.0.2",
"react": "18.2.0",
"react-native": "0.74.1",
"react-native-gesture-handler": "^2.16.2",
"react-native-reanimated": "3.11.0",
"react-native-restart": "^0.0.27",
"react-native-safe-area-context": "^4.10.1",
"react-native-screens": "link:../"
"react-native-screens": "link:../",
"react-native-vector-icons": "^8.0.0"
},
"resolutions": {
"@react-navigation/core": "link:../react-navigation/packages/core/"
Expand Down
47 changes: 0 additions & 47 deletions FabricExample/src/Chapter.js

This file was deleted.

Loading
Loading