diff --git a/lib/facts/communities.js b/lib/facts/communities.js deleted file mode 100644 index 41d97d8ba0..0000000000 --- a/lib/facts/communities.js +++ /dev/null @@ -1,57 +0,0 @@ -// @flow - -export const cryptoCommunityIDs = [ - '256|7793719', - '256|7793814', - '256|7793918', - '256|7796752', - '256|7796773', - '256|7796794', - '256|7796962', - '256|7798826', - '256|7798850', - '256|7798986', - '256|7799792', - '256|7799815', - '256|7799857', - '256|7799918', - '256|7801512', - '256|7801559', - '256|7801601', - '256|7801623', - '256|7801693', - '256|7801733', - '256|7801775', - '256|7801796', - '256|7801817', - '256|7801900', - '256|7801957', - '256|7801978', - '256|7802020', - '256|7802041', - '256|7802062', - '256|7802104', - '256|7802125', - '256|7802179', - '256|7817243', - '256|7817285', - '256|7817401', - '256|7817492', - '256|7818336', - '256|7818503', - '256|7818529', - '256|7818550', - '256|7856680', - '256|79206855', - '256|79206867', - '256|79264454', - '256|79264466', - '256|79264515', - '256|79264528', - '256|79264536', - '256|79264574', - '256|79264580', - '256|79264599', - '256|80199522', - '256|80365088', -]; diff --git a/native/components/community-joiner-modal.react.js b/native/components/community-joiner-modal.react.js deleted file mode 100644 index 0ab2cdf661..0000000000 --- a/native/components/community-joiner-modal.react.js +++ /dev/null @@ -1,228 +0,0 @@ -// @flow - -import * as React from 'react'; -import { View, Text, useWindowDimensions } from 'react-native'; -import { - TabView, - SceneMap, - TabBar, - type TabBarProps, -} from 'react-native-tab-view'; - -import { cryptoCommunityIDs } from 'lib/facts/communities.js'; -import { useThreadSearchIndex } from 'lib/selectors/nav-selectors.js'; -import { threadInfoFromRawThreadInfo } from 'lib/shared/thread-utils.js'; -import type { ClientCommunityInfoWithCommunityName } from 'lib/types/community-types.js'; - -import Modal from './modal.react.js'; -import CommunityList from '../components/community-list.react.js'; -import type { RootNavigationProp } from '../navigation/root-navigator.react.js'; -import type { NavigationRoute } from '../navigation/route-names.js'; -import { useSelector } from '../redux/redux-utils.js'; -import { useColors, useStyles } from '../themes/colors.js'; -import { - modalBorderWidth, - modalMarginHorizontal, - modalPadding, -} from '../utils/modal-consts.js'; - -export type CommunityJoinerModalParams = { - +communities: $ReadOnlyArray, -}; - -type Props = { - +navigation: RootNavigationProp<'CommunityJoinerModal'>, - +route: NavigationRoute<'CommunityJoinerModal'>, -}; - -const routes = [ - { key: 'general', title: 'General' }, - { key: 'crypto', title: 'Crypto' }, -]; - -function CommunityJoinerModal(props: Props): React.Node { - const { params } = props.route; - const { communities } = params; - - const viewerID = useSelector( - state => state.currentUserInfo && state.currentUserInfo.id, - ); - const userInfos = useSelector(state => state.userStore.userInfos); - const styles = useStyles(unboundStyles); - - const generalCommunities = React.useMemo( - () => - communities.filter( - community => !cryptoCommunityIDs.includes(community.id), - ), - [communities], - ); - const cryptoCommunities = React.useMemo( - () => - communities.filter(community => - cryptoCommunityIDs.includes(community.id), - ), - [communities], - ); - - const generateThreadInfos = React.useCallback( - (communityList: $ReadOnlyArray) => - communityList - .map(community => - community.threadInfo - ? threadInfoFromRawThreadInfo( - community.threadInfo, - viewerID, - userInfos, - ) - : null, - ) - .filter(Boolean), - [userInfos, viewerID], - ); - - const generalThreadInfos = React.useMemo( - () => generateThreadInfos(generalCommunities), - [generateThreadInfos, generalCommunities], - ); - - const cryptoThreadInfos = React.useMemo( - () => generateThreadInfos(cryptoCommunities), - [generateThreadInfos, cryptoCommunities], - ); - - const generalIndex = useThreadSearchIndex(generalThreadInfos); - const cryptoIndex = useThreadSearchIndex(cryptoThreadInfos); - - const renderGeneralTab = React.useCallback( - () => ( - - ), - [generalIndex, generalThreadInfos, styles.threadListItem], - ); - - const renderCryptoTab = React.useCallback( - () => ( - - ), - [cryptoIndex, cryptoThreadInfos, styles.threadListItem], - ); - - const [index, setIndex] = React.useState(0); - - const navigationState = React.useMemo(() => ({ index, routes }), [index]); - - const renderScene = React.useMemo( - () => - SceneMap({ - general: renderGeneralTab, - crypto: renderCryptoTab, - }), - [renderCryptoTab, renderGeneralTab], - ); - - const colors = useColors(); - const { - modalBackground, - tabBarAccent, - modalForegroundLabel, - modalForegroundSecondaryLabel, - } = colors; - - const tabProps = React.useMemo( - () => ({ - style: { - backgroundColor: modalBackground, - }, - indicatorStyle: { - borderColor: tabBarAccent, - borderBottomWidth: 2, - }, - activeColor: modalForegroundLabel, - inactiveColor: modalForegroundSecondaryLabel, - }), - [ - modalForegroundLabel, - modalForegroundSecondaryLabel, - tabBarAccent, - modalBackground, - ], - ); - - const windowDimensions = useWindowDimensions(); - const initialLayout = React.useMemo( - () => ({ - width: - windowDimensions.width - - 2 * (modalBorderWidth + modalMarginHorizontal + modalPadding), - }), - [windowDimensions.width], - ); - - const renderTabBar = React.useCallback( - (tabBarProps: TabBarProps) => ( - - - - ), - [ - tabProps.activeColor, - tabProps.inactiveColor, - tabProps.indicatorStyle, - tabProps.style, - styles.tabBarContainer, - ], - ); - - return ( - - - Discover communities - - - - ); -} - -const unboundStyles = { - headerContainer: { - padding: 10, - paddingBottom: 0, - }, - headerText: { - color: 'modalForegroundLabel', - fontSize: 20, - marginBottom: 8, - textAlign: 'center', - }, - threadListItem: { - paddingLeft: 10, - paddingRight: 10, - paddingVertical: 2, - }, - tabBarContainer: { - marginBottom: 15, - }, -}; - -export default CommunityJoinerModal; diff --git a/native/components/modal.react.js b/native/components/modal.react.js index 6829266c3a..1fe3784111 100644 --- a/native/components/modal.react.js +++ b/native/components/modal.react.js @@ -8,11 +8,6 @@ import { SafeAreaView } from 'react-native-safe-area-context'; import KeyboardAvoidingView from './keyboard-avoiding-view.react.js'; import { useStyles } from '../themes/colors.js'; import type { ViewStyle } from '../types/styles.js'; -import { - modalBorderWidth, - modalMarginHorizontal, - modalPadding, -} from '../utils/modal-consts.js'; type Props = $ReadOnly<{ +children: React.Node, @@ -58,14 +53,14 @@ const unboundStyles = { modal: { backgroundColor: 'modalBackground', borderColor: 'modalForegroundBorder', - borderWidth: modalBorderWidth, + borderWidth: 2, borderRadius: 5, flex: 1, justifyContent: 'center', marginBottom: 30, - marginHorizontal: modalMarginHorizontal, + marginHorizontal: 15, marginTop: 100, - padding: modalPadding, + padding: 12, }, }; diff --git a/native/flow-typed/npm/react-native-tab-view_v3.x.x.js b/native/flow-typed/npm/react-native-tab-view_v3.x.x.js deleted file mode 100644 index 40474ecfa6..0000000000 --- a/native/flow-typed/npm/react-native-tab-view_v3.x.x.js +++ /dev/null @@ -1,124 +0,0 @@ -// flow-typed signature: a7123e367e1cd3cb25dcd811f56eea57 -// flow-typed version: <>/react-native-tab-view_v3.3.0/flow_v0.202.1 - -declare module 'react-native-tab-view' { - import type { Route } from '@react-navigation/core'; - - declare type StyleObj = - | null - | void - | number - | false - | '' - | $ReadOnlyArray - | { [name: string]: any, ... }; - declare export type ViewStyle = StyleObj; - - declare interface AnimatedTracking { - constructor( - value: AnimatedValue, - parent: any, - animationClass: any, - animationConfig: Object, - callback?: ?EndCallback, - ): void; - update(): void; - } - - declare type ExtrapolateType = 'extend' | 'identity' | 'clamp'; - declare type InterpolationConfigType = { - inputRange: Array, - outputRange: Array | Array, - easing?: (input: number) => number, - extrapolate?: ExtrapolateType, - extrapolateLeft?: ExtrapolateType, - extrapolateRight?: ExtrapolateType, - ... - }; - declare interface AnimatedInterpolation { - interpolate(config: InterpolationConfigType): AnimatedInterpolation; - } - - declare type EndResult = { finished: boolean, ... }; - declare type EndCallback = (result: EndResult) => void; - - declare interface Animation { - start( - fromValue: number, - onUpdate: (value: number) => void, - onEnd: ?EndCallback, - previousAnimation: ?Animation, - animatedValue: AnimatedValue, - ): void; - stop(): void; - } - - declare type ValueListenerCallback = (state: { value: number, ... }) => void; - declare interface AnimatedValue { - constructor(value: number): void; - setValue(value: number): void; - setOffset(offset: number): void; - flattenOffset(): void; - extractOffset(): void; - addListener(callback: ValueListenerCallback): string; - removeListener(id: string): void; - removeAllListeners(): void; - stopAnimation(callback?: ?(value: number) => void): void; - resetAnimation(callback?: ?(value: number) => void): void; - interpolate(config: InterpolationConfigType): AnimatedInterpolation; - animate(animation: Animation, callback: ?EndCallback): void; - stopTracking(): void; - track(tracking: AnimatedTracking): void; - } - - declare type Layout = { - +width: number, - +height: number, - }; - declare type SceneRendererProps = { - +layout: Layout, - +jumpTo: (key: string) => void, - ... - }; - - declare export var TabBarItem: React$ComponentType<{ - +position: AnimatedInterpolation, - +route: Route<>, - +navigationState: { +index: number, ... }, - +onPress: () => void, - +onLongPress: () => void, - +style: ViewStyle, - +getLabelText?: () => string, - +getAccessible?: () => void, - +getAccessibilityLabel?: () => void, - +renderIcon?: ({ color: string, ... }) => React$Node, - +getTestID?: () => void, - +activeColor?: string, - ... - }>; - - declare export var TabView: React$ComponentType<{ - +navigationState: { +index: number, ... }, - +renderScene: (props: SceneRendererProps & { +route: Route<>, ... }) => React$Node, - +onIndexChange: (number) => void, - +initialLayout: Partial, - +renderTabBar: (TabBarProps) => React$Node, - ... - }>; - - declare export function SceneMap(scenes: { - [key: string]: () => React$Node, - }): (props: SceneRendererProps & { +route: Route<>, ... }) => React$Node; - - declare export var TabBar: React$ComponentType<{ - +style: ViewStyle, - +indicatorStyle: ViewStyle, - ... - }>; - - declare export type TabBarProps = { - +style: ViewStyle, - +indicatorStyle: ViewStyle, - ... - } -} diff --git a/native/navigation/chat-tab-bar-button.react.js b/native/navigation/chat-tab-bar-button.react.js index 8c7ca2d834..1e3f006db2 100644 --- a/native/navigation/chat-tab-bar-button.react.js +++ b/native/navigation/chat-tab-bar-button.react.js @@ -43,7 +43,7 @@ function createChatTabBarButton( function ChatTabBarButton(): React.Node { const { title, tabBarIcon: Icon } = props; - const position = React.useRef(new Animated.Value(0)); + const position = React.useRef(() => new Animated.Value(0)); const route = useRoute(); const activeTheme = useSelector(state => state.globalThemeInfo.activeTheme); diff --git a/native/navigation/root-navigator.react.js b/native/navigation/root-navigator.react.js index e19a428d9b..e03f63c654 100644 --- a/native/navigation/root-navigator.react.js +++ b/native/navigation/root-navigator.react.js @@ -57,7 +57,6 @@ import { CreateMissingSIWEBackupMessageRouteName, LinkedDevicesBottomSheetRouteName, QRAuthNavigatorRouteName, - CommunityJoinerModalRouteName, } from './route-names.js'; import LoggedOutModal from '../account/logged-out-modal.react.js'; import QRAuthNavigator from '../account/qr-auth/qr-auth-navigator.react.js'; @@ -74,7 +73,6 @@ 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 TagFarcasterChannelNavigator from '../community-settings/tag-farcaster-channel/tag-farcaster-channel-navigator.react.js'; -import CommunityJoinerModal from '../components/community-joiner-modal.react.js'; import ConnectFarcasterBottomSheet from '../components/connect-farcaster-bottom-sheet.react.js'; import DirectoryPromptBottomSheet from '../components/directory-prompt-bottom-sheet.react.js'; import InviteLinksNavigator from '../invite-links/invite-links-navigator.react.js'; @@ -308,11 +306,6 @@ function RootComponent(): React.Node { component={DirectoryPromptBottomSheet} options={modalOverlayScreenOptions} /> -