From d39bc829094f113e6485bcdb11c1d67cea24d478 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Thu, 14 Jan 2021 22:53:01 +0100 Subject: [PATCH 01/62] Updates --- package.json | 2 + src/@types/react-navigation.d.ts | 12 +- src/components/BottomSheet.tsx | 65 +++++--- src/components/Header/Right.tsx | 12 +- src/components/Menu/Row.tsx | 154 +++++++++--------- src/components/Timelines.tsx | 34 ++-- src/components/Timelines/Timeline.tsx | 5 +- .../Timelines/Timeline/Shared/Actions.tsx | 3 +- .../Timelines/Timeline/Shared/Card.tsx | 46 ++++++ .../Shared/HeaderActions/ActionsStatus.tsx | 3 +- src/screens/Me/Root.tsx | 1 - src/screens/Shared/Account/Header.tsx | 4 +- src/screens/Shared/Account/Toots.tsx | 6 +- src/screens/Shared/Compose.tsx | 37 ++--- src/screens/Shared/Compose/Posting.tsx | 43 +++++ src/screens/Shared/Compose/Root.tsx | 2 + .../Shared/Compose/utils/initialState.ts | 5 +- src/screens/Shared/Compose/utils/post.ts | 6 +- src/screens/Shared/Compose/utils/reducer.ts | 2 + src/screens/Shared/Compose/utils/types.d.ts | 5 + src/screens/Shared/Relationships.tsx | 6 +- yarn.lock | 10 ++ 22 files changed, 300 insertions(+), 163 deletions(-) create mode 100644 src/screens/Shared/Compose/Posting.tsx diff --git a/package.json b/package.json index 5b5f0764..32a029f9 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@react-native-community/masked-view": "0.1.10", "@react-native-community/netinfo": "^5.9.7", "@react-native-community/segmented-control": "2.2.1", + "@react-native-community/viewpager": "4.2.0", "@react-navigation/bottom-tabs": "^5.11.2", "@react-navigation/native": "^5.8.10", "@reduxjs/toolkit": "^1.5.0", @@ -61,6 +62,7 @@ "react-native-shimmer-placeholder": "^2.0.6", "react-native-svg": "12.1.0", "react-native-tab-view": "^2.15.2", + "react-native-tab-view-viewpager-adapter": "^1.1.0", "react-native-toast-message": "^1.4.2", "react-navigation": "^4.4.3", "react-query": "^3.5.6", diff --git a/src/@types/react-navigation.d.ts b/src/@types/react-navigation.d.ts index 0d18180a..4d0b2881 100644 --- a/src/@types/react-navigation.d.ts +++ b/src/@types/react-navigation.d.ts @@ -14,8 +14,18 @@ declare namespace Nav { 'Screen-Shared-Announcements': { showAll?: boolean } 'Screen-Shared-Compose': | { - type?: 'reply' | 'conversation' | 'edit' + type: 'reply' | 'conversation' | 'edit' incomingStatus: Mastodon.Status + queryKey?: [ + 'Timeline', + { + page: App.Pages + hashtag?: Mastodon.Tag['name'] + list?: Mastodon.List['id'] + toot?: Mastodon.Status['id'] + account?: Mastodon.Account['id'] + } + ] } | undefined 'Screen-Shared-Hashtag': { diff --git a/src/components/BottomSheet.tsx b/src/components/BottomSheet.tsx index e8f7d2cc..ae5a73f2 100644 --- a/src/components/BottomSheet.tsx +++ b/src/components/BottomSheet.tsx @@ -1,10 +1,14 @@ -import React from 'react' +import React, { useRef } from 'react' import { Dimensions, Modal, StyleSheet, View } from 'react-native' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { useTheme } from '@utils/styles/ThemeManager' import { StyleConstants } from '@utils/styles/constants' import Button from '@components/Button' -import { PanGestureHandler } from 'react-native-gesture-handler' +import { + PanGestureHandler, + State, + TapGestureHandler +} from 'react-native-gesture-handler' import Animated, { Extrapolate, interpolate, @@ -55,33 +59,44 @@ const BottomSheet: React.FC = ({ children, visible, handleDismiss }) => { return ( - + { + if (nativeEvent.state === State.ACTIVE) { + callDismiss() + } + }} + > - - - {children} -