From bcb55254f944654d9b7bb4da9268beecc9bc9a20 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Tue, 16 Mar 2021 23:15:37 +0100 Subject: [PATCH] Refine RN 0.64 --- fastlane/Fastfile | 12 +++--- ios/Podfile.lock | 4 +- package.json | 2 +- src/components/Timeline/Conversation.tsx | 21 ++++------- src/components/Timeline/Default.tsx | 34 +++++++---------- src/components/Timeline/Notifications.tsx | 37 ++++++++----------- src/components/Timeline/Refresh.tsx | 5 ++- src/components/Timeline/Shared/Actions.tsx | 13 +++++-- .../Timeline/Shared/FullConversation.tsx | 4 +- src/i18n/zh-Hans/components/timeline.ts | 2 +- src/i18n/zh-Hans/screens/meFavourites.ts | 2 +- src/i18n/zh-Hans/screens/sharedUsers.ts | 2 +- src/screens/Compose.tsx | 9 ++++- src/screens/Compose/EditAttachment/Submit.tsx | 3 +- src/screens/Tabs/Shared/sharedScreens.tsx | 9 ++++- src/utils/styles/constants.ts | 4 +- src/utils/styles/scaling.ts | 8 ++-- yarn.lock | 8 ++-- 18 files changed, 91 insertions(+), 88 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 5de26ef9..58317885 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -12,12 +12,12 @@ RELEASE_CHANNEL = "#{VERSIONS[:major]}-#{ENVIRONMENT}" BUILD_NUMBER = ENV["GITHUB_RUN_NUMBER"] GITHUB_REPO = "tooot-app/app" case ENVIRONMENT -when "main" - GITHUB_RELEASE= "" when "candidate" GITHUB_RELEASE = "v#{VERSION}-#{VERSIONS[:patch]}" when "release" GITHUB_RELEASE = "v#{VERSION}" +else + GITHUB_RELEASE= "" end XCODEPROJ = "./ios/tooot.xcodeproj" @@ -82,7 +82,7 @@ private_lane :build_ios do install_pods_ios prepare_appstore_ios match( type: "appstore", readonly: true ) - build_ios_app( export_method: "app-store", include_symbols: true, include_bitcode: true ) + build_ios_app( export_method: "app-store", include_symbols: true, include_bitcode: true, silent: true ) upload_to_testflight( demo_account_required: true, distribute_external: true, @@ -92,12 +92,12 @@ private_lane :build_ios do when "release" install_pods_ios prepare_appstore_ios - match( type: "appstore", readonly: true, include_bitcode: true ) - build_ios_app( export_method: "app-store" ) + match( type: "appstore", readonly: true ) + build_ios_app( export_method: "app-store", include_bitcode: true, silent: true ) else if !is_ci match( type: "development", readonly: true ) - build_ios_app( export_method: "development", output_directory: BUILD_DIRECTORY ) + build_ios_app( export_method: "development", output_directory: BUILD_DIRECTORY, silent: true ) install_on_device( skip_wifi: true ) end end diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d31c944f..eaec2492 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -487,7 +487,7 @@ PODS: - React-RCTVibration - ReactCommon/turbomodule/core - Yoga - - RNScreens (2.18.1): + - RNScreens (2.17.1): - React-Core - RNSentry (2.3.0): - React-Core @@ -889,7 +889,7 @@ SPEC CHECKSUMS: RNFastImage: d4870d58f5936111c56218dbd7fcfc18e65b58ff RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211 RNReanimated: 64f6c5789f82818c07ba3c71864b73619cb23c76 - RNScreens: f7ad633b2e0190b77b6a7aab7f914fad6f198d8d + RNScreens: b6c9607e6fe47c1b6e2f1910d2acd46dd7ecea3a RNSentry: 4f6907f9a4a41058988ebaa17666e9a402b50ff2 RNSVG: ce9d996113475209013317e48b05c21ee988d42e SDWebImage: e378178472b735e84b007bfb55514c97948a0598 diff --git a/package.json b/package.json index bd180df7..36ff7ada 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "react-native-pager-view": "^5.1.2", "react-native-reanimated": "^2.0.0", "react-native-safe-area-context": "3.2.0", - "react-native-screens": "~2.18.1", + "react-native-screens": "~2.17.1", "react-native-svg": "12.1.0", "react-native-swipe-list-view": "^3.2.6", "react-native-tab-view": "^3.0.0", diff --git a/src/components/Timeline/Conversation.tsx b/src/components/Timeline/Conversation.tsx index 74533545..eb10058d 100644 --- a/src/components/Timeline/Conversation.tsx +++ b/src/components/Timeline/Conversation.tsx @@ -140,20 +140,13 @@ const TimelineConversation: React.FC = ({ /> )} - - account.acct)} - reblog={false} - /> - + account.acct)} + reblog={false} + /> ) : null} diff --git a/src/components/Timeline/Default.tsx b/src/components/Timeline/Default.tsx index e9e738e7..278cf8c9 100644 --- a/src/components/Timeline/Default.tsx +++ b/src/components/Timeline/Default.tsx @@ -132,27 +132,19 @@ const TimelineDefault: React.FC = ({ {queryKey && !disableDetails && ( - - d.id !== instanceAccount?.id), - d => d.id - ).map(d => d.acct)} - reblog={item.reblog ? true : false} - /> - + d?.id !== instanceAccount?.id), + d => d.id + ).map(d => d.acct)} + reblog={item.reblog ? true : false} + /> )} ) diff --git a/src/components/Timeline/Notifications.tsx b/src/components/Timeline/Notifications.tsx index f09ac682..587ed240 100644 --- a/src/components/Timeline/Notifications.tsx +++ b/src/components/Timeline/Notifications.tsx @@ -129,28 +129,21 @@ const TimelineNotifications: React.FC = ({ ) : null} - {notification.status && ( - - d.id !== instanceAccount?.id), - d => d.id - ).map(d => d.acct)} - reblog={false} - /> - - )} + {notification.status ? ( + d.id !== instanceAccount?.id), + d => d.id + ).map(d => d.acct)} + reblog={false} + /> + ) : null} ) } diff --git a/src/components/Timeline/Refresh.tsx b/src/components/Timeline/Refresh.tsx index a870939b..20109ce8 100644 --- a/src/components/Timeline/Refresh.tsx +++ b/src/components/Timeline/Refresh.tsx @@ -9,7 +9,7 @@ import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' import React, { useCallback, useRef, useState } from 'react' import { useTranslation } from 'react-i18next' -import { StyleSheet, Text, View } from 'react-native' +import { Platform, StyleSheet, Text, View } from 'react-native' import { Circle } from 'react-native-animated-spinkit' import Animated, { Extrapolate, @@ -45,6 +45,9 @@ const TimelineRefresh: React.FC = ({ fetchingType, disableRefresh = false }) => { + if (Platform.OS !== 'ios') { + return null + } if (disableRefresh) { return null } diff --git a/src/components/Timeline/Shared/Actions.tsx b/src/components/Timeline/Shared/Actions.tsx index fb050245..89417f1d 100644 --- a/src/components/Timeline/Shared/Actions.tsx +++ b/src/components/Timeline/Shared/Actions.tsx @@ -17,13 +17,14 @@ import { useQueryClient } from 'react-query' export interface Props { queryKey: QueryKeyTimeline rootQueryKey?: QueryKeyTimeline + highlighted: boolean status: Mastodon.Status accts: Mastodon.Account['acct'][] // When replying to conversations reblog: boolean } const TimelineActions = React.memo( - ({ queryKey, rootQueryKey, status, accts, reblog }: Props) => { + ({ queryKey, rootQueryKey, highlighted, status, accts, reblog }: Props) => { const navigation = useNavigation() const { t } = useTranslation('componentTimeline') const { mode, theme } = useTheme() @@ -256,7 +257,13 @@ const TimelineActions = React.memo( ) return ( - <> + - + ) }, () => true diff --git a/src/components/Timeline/Shared/FullConversation.tsx b/src/components/Timeline/Shared/FullConversation.tsx index b69a71cf..79b65c15 100644 --- a/src/components/Timeline/Shared/FullConversation.tsx +++ b/src/components/Timeline/Shared/FullConversation.tsx @@ -24,9 +24,9 @@ const TimelineFullConversation = React.memo( ).length) ? ( {t('shared.fullConversation')} diff --git a/src/i18n/zh-Hans/components/timeline.ts b/src/i18n/zh-Hans/components/timeline.ts index 6d7871e1..3930008c 100644 --- a/src/i18n/zh-Hans/components/timeline.ts +++ b/src/i18n/zh-Hans/components/timeline.ts @@ -36,7 +36,7 @@ export default { function: '转嘟' }, bookmarked: { - function: '收藏嘟文' + function: '喜欢嘟文' } }, actionsUsers: { diff --git a/src/i18n/zh-Hans/screens/meFavourites.ts b/src/i18n/zh-Hans/screens/meFavourites.ts index 48f5e62d..072aeae6 100644 --- a/src/i18n/zh-Hans/screens/meFavourites.ts +++ b/src/i18n/zh-Hans/screens/meFavourites.ts @@ -1,4 +1,4 @@ export default { - heading: '收藏', + heading: '喜欢', content: {} } diff --git a/src/i18n/zh-Hans/screens/sharedUsers.ts b/src/i18n/zh-Hans/screens/sharedUsers.ts index 60450284..6222f837 100644 --- a/src/i18n/zh-Hans/screens/sharedUsers.ts +++ b/src/i18n/zh-Hans/screens/sharedUsers.ts @@ -6,7 +6,7 @@ export default { }, statuses: { reblogged_by: '{{count}} 人转嘟', - favourited_by: '{{count}} 人收藏' + favourited_by: '{{count}} 人喜欢' } } } diff --git a/src/screens/Compose.tsx b/src/screens/Compose.tsx index 6b3d6f4d..5d0f1838 100644 --- a/src/screens/Compose.tsx +++ b/src/screens/Compose.tsx @@ -1,5 +1,5 @@ import analytics from '@components/analytics' -import { HeaderLeft, HeaderRight } from '@components/Header' +import { HeaderCenter, HeaderLeft, HeaderRight } from '@components/Header' import { StackScreenProps } from '@react-navigation/stack' import haptics from '@root/components/haptics' import formatText from '@screens/Compose/formatText' @@ -371,6 +371,13 @@ const ScreenCompose: React.FC = ({ }, headerTintColor: totalTextCount > maxTootChars ? theme.red : theme.secondary, + headerCenter: () => ( + + ), headerRight }} /> diff --git a/src/screens/Compose/EditAttachment/Submit.tsx b/src/screens/Compose/EditAttachment/Submit.tsx index 0e67a436..e6c901e0 100644 --- a/src/screens/Compose/EditAttachment/Submit.tsx +++ b/src/screens/Compose/EditAttachment/Submit.tsx @@ -39,7 +39,8 @@ const ComposeEditAttachmentSubmit: React.FC = ({ index }) => { ) { formData.append( 'focus', - `${theAttachment.meta.focus.x},${-theAttachment.meta.focus.y}` + `${theAttachment.meta.focus.x || 0},${-theAttachment.meta.focus.y || + 0}` ) } diff --git a/src/screens/Tabs/Shared/sharedScreens.tsx b/src/screens/Tabs/Shared/sharedScreens.tsx index d7491706..9c9c72af 100644 --- a/src/screens/Tabs/Shared/sharedScreens.tsx +++ b/src/screens/Tabs/Shared/sharedScreens.tsx @@ -211,7 +211,14 @@ const sharedScreens = ( } }: SharedUsersProp) => ({ headerLeft: () => navigation.goBack()} />, - headerTitle: t(`sharedUsers:heading.${reference}.${type}`, { count }) + headerTitle: t(`sharedUsers:heading.${reference}.${type}`, { count }), + ...(Platform.OS === 'android' && { + headerCenter: () => ( + + ) + }) })} /> ] diff --git a/src/utils/styles/constants.ts b/src/utils/styles/constants.ts index c66e38c1..854f5462 100644 --- a/src/utils/styles/constants.ts +++ b/src/utils/styles/constants.ts @@ -6,14 +6,14 @@ export const StyleConstants = { LineHeight: { S: 20, M: 22, - L: 30 + L: 28 }, Weight: { Normal: '400' as '400', Bold: '600' as '600' } }, FontStyle: { S: { fontSize: 14, lineHeight: 20 }, M: { fontSize: 16, lineHeight: 22 }, - L: { fontSize: 20, lineHeight: 30 } + L: { fontSize: 20, lineHeight: 28 } }, Spacing: { diff --git a/src/utils/styles/scaling.ts b/src/utils/styles/scaling.ts index d0ac964e..ac6c1f3f 100644 --- a/src/utils/styles/scaling.ts +++ b/src/utils/styles/scaling.ts @@ -1,11 +1,11 @@ -import { Dimensions } from 'react-native' +// import { Dimensions } from 'react-native' -const { width } = Dimensions.get('screen') +// const { width } = Dimensions.get('screen') -const guidelineBaseWidth = 375 +// const guidelineBaseWidth = 375 // const guidelineBaseHeight = 667 -const scale = (size: number) => (width / guidelineBaseWidth) * size +// const scale = (size: number) => (width / guidelineBaseWidth) * size // const verticalScale = (size: number) => (height / guidelineBaseHeight) * size // const adaptiveScale = (size: number, factor: number = 0) => // size + (scale(size) - size) * factor diff --git a/yarn.lock b/yarn.lock index b29bbcf7..c8b46619 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8809,10 +8809,10 @@ react-native-safe-area-view@^0.14.9: dependencies: hoist-non-react-statics "^2.3.1" -react-native-screens@~2.18.1: - version "2.18.1" - resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-2.18.1.tgz#47b9991c6f762d00d0ed3233e5283d523e859885" - integrity sha512-r5WZLpmx2hHjC1RgMdPq5YpSU9tEhBpUaZ5M1SUtNIONyiLqQVxabhRCINdebIk4depJiIl7yw2Q85zJyeX6fw== +react-native-screens@~2.17.1: + version "2.17.1" + resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-2.17.1.tgz#c3c0ac750af48741c5b1635511e6af2a27b74309" + integrity sha512-B4gD5e4csvlVwlhf+RNqjQZ9mHTwe/iL3rXondgZxnKz4oW0QAmtLnLRKOrYVxoaJaF9Fy7jhjo//24/472APQ== react-native-svg@12.1.0: version "12.1.0"