Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3406229
D7950.id26914.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D7950.id26914.diff
View Options
diff --git a/native/community-creation/community-configuration.react.js b/native/community-creation/community-configuration.react.js
new file mode 100644
--- /dev/null
+++ b/native/community-creation/community-configuration.react.js
@@ -0,0 +1,18 @@
+// @flow
+
+import * as React from 'react';
+
+import type { CommunityCreationNavigationProp } from './community-creation-navigator.react.js';
+import { type NavigationRoute } from '../navigation/route-names.js';
+
+type Props = {
+ +navigation: CommunityCreationNavigationProp<'CommunityConfiguration'>,
+ +route: NavigationRoute<'CommunityConfiguration'>,
+};
+
+// eslint-disable-next-line no-unused-vars
+function CommunityConfiguration(props: Props): React.Node {
+ return null;
+}
+
+export default CommunityConfiguration;
diff --git a/native/community-creation/community-creation-navigator.react.js b/native/community-creation/community-creation-navigator.react.js
new file mode 100644
--- /dev/null
+++ b/native/community-creation/community-creation-navigator.react.js
@@ -0,0 +1,54 @@
+// @flow
+
+import {
+ createStackNavigator,
+ type StackNavigationProp,
+ type StackNavigationHelpers,
+} from '@react-navigation/stack';
+import * as React from 'react';
+
+import CommunityConfiguration from './community-configuration.react.js';
+import type { RootNavigationProp } from '../navigation/root-navigator.react.js';
+import {
+ CommunityConfigurationRouteName,
+ type ScreenParamList,
+ type CommunityCreationParamList,
+} from '../navigation/route-names.js';
+
+export type CommunityCreationNavigationProp<
+ RouteName: $Keys<CommunityCreationParamList>,
+> = StackNavigationProp<ScreenParamList, RouteName>;
+
+const CommunityCreation = createStackNavigator<
+ ScreenParamList,
+ CommunityCreationParamList,
+ StackNavigationHelpers<ScreenParamList>,
+>();
+
+const screenOptions = {
+ headerTransparent: true,
+ headerBackTitleVisible: false,
+ headerTitle: 'Create a community',
+ headerTintColor: 'white',
+ headerLeftContainerStyle: {
+ paddingLeft: 12,
+ },
+};
+
+type Props = {
+ +navigation: RootNavigationProp<'CommunityCreation'>,
+ ...
+};
+// eslint-disable-next-line no-unused-vars
+function CommunityCreationNavigator(props: Props): React.Node {
+ return (
+ <CommunityCreation.Navigator screenOptions={screenOptions}>
+ <CommunityCreation.Screen
+ name={CommunityConfigurationRouteName}
+ component={CommunityConfiguration}
+ />
+ </CommunityCreation.Navigator>
+ );
+}
+
+export default CommunityCreationNavigator;
diff --git a/native/navigation/community-drawer-content.react.js b/native/navigation/community-drawer-content.react.js
--- a/native/navigation/community-drawer-content.react.js
+++ b/native/navigation/community-drawer-content.react.js
@@ -1,7 +1,8 @@
// @flow
+import { useNavigation } from '@react-navigation/native';
import * as React from 'react';
-import { FlatList, Platform, View, Text } from 'react-native';
+import { FlatList, Platform, View, Text, TouchableOpacity } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { useSelector } from 'react-redux';
@@ -16,6 +17,7 @@
import { useResolvedThreadInfos } from 'lib/utils/entity-helpers.js';
import CommunityDrawerItemCommunity from './community-drawer-item-community.react.js';
+import { CommunityCreationRouteName } from './route-names.js';
import { useNavigateToThread } from '../chat/message-list-types.js';
import SWMansionIcon from '../components/swmansion-icon.react.js';
import { useStyles } from '../themes/colors.js';
@@ -80,20 +82,27 @@
[childThreadInfosMap, communitiesSuffixed, labelStyles],
);
+ const { navigate } = useNavigation();
+ const onPressCommunityCreation = React.useCallback(() => {
+ navigate(CommunityCreationRouteName);
+ }, [navigate]);
+
const isCommunityCreationButtonEnabled = true;
let communityCreationButton;
if (isCommunityCreationButtonEnabled) {
communityCreationButton = (
- <View style={styles.communityCreationContainer}>
- <View style={styles.communityCreationIconContainer}>
- <SWMansionIcon
- name="plus"
- size={22}
- style={styles.communityCreationIcon}
- />
+ <TouchableOpacity onPress={onPressCommunityCreation} activeOpacity={0.4}>
+ <View style={styles.communityCreationContainer}>
+ <View style={styles.communityCreationIconContainer}>
+ <SWMansionIcon
+ name="plus"
+ size={22}
+ style={styles.communityCreationIcon}
+ />
+ </View>
+ <Text style={styles.communityCreationText}>Create community</Text>
</View>
- <Text style={styles.communityCreationText}>Create community</Text>
- </View>
+ </TouchableOpacity>
);
}
diff --git a/native/navigation/root-navigator.react.js b/native/navigation/root-navigator.react.js
--- a/native/navigation/root-navigator.react.js
+++ b/native/navigation/root-navigator.react.js
@@ -41,6 +41,7 @@
TermsAndPrivacyRouteName,
RegistrationRouteName,
InviteLinkModalRouteName,
+ CommunityCreationRouteName,
} from './route-names.js';
import LoggedOutModal from '../account/logged-out-modal.react.js';
import RegistrationNavigator from '../account/registration/registration-navigator.react.js';
@@ -53,6 +54,7 @@
import ComposeSubchannelModal from '../chat/settings/compose-subchannel-modal.react.js';
import SidebarListModal from '../chat/sidebar-list-modal.react.js';
import SubchannelsListModal from '../chat/subchannels-list-modal.react.js';
+import CommunityCreationNavigator from '../community-creation/community-creation-navigator.react.js';
import CustomServerModal from '../profile/custom-server-modal.react.js';
enableScreens();
@@ -199,6 +201,11 @@
component={RegistrationNavigator}
options={disableGesturesScreenOptions}
/>
+ <Root.Screen
+ name={CommunityCreationRouteName}
+ component={CommunityCreationNavigator}
+ options={disableGesturesScreenOptions}
+ />
<Root.Screen name={AppRouteName} component={AppNavigator} />
<Root.Screen
name={TermsAndPrivacyRouteName}
diff --git a/native/navigation/route-names.js b/native/navigation/route-names.js
--- a/native/navigation/route-names.js
+++ b/native/navigation/route-names.js
@@ -99,6 +99,8 @@
export const ConnectEthereumRouteName = 'ConnectEthereum';
export const ExistingEthereumAccountRouteName = 'ExistingEthereumAccount';
export const UsernameSelectionRouteName = 'UsernameSelection';
+export const CommunityCreationRouteName = 'CommunityCreation';
+export const CommunityConfigurationRouteName = 'CommunityConfiguration';
export type RootParamList = {
+LoggedOutModal: void,
@@ -114,6 +116,7 @@
+SubchannelsListModal: SubchannelListModalParams,
+MessageReactionsModal: MessageReactionsModalParams,
+Registration: void,
+ +CommunityCreation: void,
+InviteLinkModal: InviteLinkModalParams,
};
@@ -194,6 +197,10 @@
+UsernameSelection: UsernameSelectionParams,
};
+export type CommunityCreationParamList = {
+ +CommunityConfiguration: void,
+};
+
export type ScreenParamList = {
...RootParamList,
...OverlayParamList,
@@ -203,6 +210,7 @@
...ProfileParamList,
...CommunityDrawerParamList,
...RegistrationParamList,
+ ...CommunityCreationParamList,
};
export type NavigationRoute<RouteName: string = $Keys<ScreenParamList>> =
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 5, 1:13 AM (12 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2615393
Default Alt Text
D7950.id26914.diff (7 KB)
Attached To
Mode
D7950: [native] Introduce `CommunityCreationNavigator`
Attached
Detach File
Event Timeline
Log In to Comment