Page MenuHomePhabricator

D5732.id20365.diff
No OneTemporary

D5732.id20365.diff

diff --git a/native/navigation/community-drawer-navigator.react.js b/native/navigation/community-drawer-navigator.react.js
new file mode 100644
--- /dev/null
+++ b/native/navigation/community-drawer-navigator.react.js
@@ -0,0 +1,55 @@
+// @flow
+
+import { createDrawerNavigator } from '@react-navigation/drawer';
+import * as React from 'react';
+import { Dimensions, View } from 'react-native';
+
+import { useStyles } from '../themes/colors';
+import type { AppNavigationProp } from './app-navigator.react';
+import CommunityDrawerContent from './community-drawer-content.react';
+import { TabNavigatorRouteName } from './route-names';
+import type { NavigationRoute } from './route-names';
+import TabNavigator from './tab-navigator.react';
+
+const Drawer = createDrawerNavigator();
+
+const communityDrawerContent = () => <CommunityDrawerContent />;
+
+type Props = {
+ +navigation: AppNavigationProp<'CommunityDrawerNavigator'>,
+ +route: NavigationRoute<'CommunityDrawerNavigator'>,
+};
+
+// eslint-disable-next-line no-unused-vars
+function CommunityDrawerNavigator(props: Props): React.Node {
+ const styles = useStyles(unboundStyles);
+
+ const screenOptions = React.useMemo(
+ () => ({
+ drawerStyle: styles.drawerStyle,
+ }),
+ [styles.drawerStyle],
+ );
+
+ return (
+ <View style={styles.drawerView}>
+ <Drawer.Navigator
+ screenOptions={screenOptions}
+ drawerContent={communityDrawerContent}
+ >
+ <Drawer.Screen name={TabNavigatorRouteName} component={TabNavigator} />
+ </Drawer.Navigator>
+ </View>
+ );
+}
+
+const unboundStyles = {
+ drawerView: {
+ flex: 1,
+ },
+ drawerStyle: {
+ width: Dimensions.get('window').width - 36,
+ },
+};
+
+export { CommunityDrawerNavigator };

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 8:25 PM (21 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2577010
Default Alt Text
D5732.id20365.diff (1 KB)

Event Timeline