From a9326c381a231b092fcd54ef8b00f9b2a70748c4 Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Sat, 13 Feb 2021 13:08:34 +0100 Subject: [PATCH] Fix android screens --- fastlane/Fastfile | 2 +- src/components/Timeline.tsx | 28 +++++++++++++++++++++++++++- src/screens/Compose.tsx | 2 +- src/screens/Tabs/Me.tsx | 7 +++---- src/screens/Tabs/Me/Switch.tsx | 5 ++++- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 01a69f64..015e237d 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -100,7 +100,7 @@ private_lane :build_android do if !is_ci build_android_app( task: 'assemble', - build_type: 'debug', + build_type: 'release', project_dir: "./android" ) adb( diff --git a/src/components/Timeline.tsx b/src/components/Timeline.tsx index 9f4287a0..88dbb465 100644 --- a/src/components/Timeline.tsx +++ b/src/components/Timeline.tsx @@ -3,9 +3,15 @@ import { useNavigation, useScrollToTop } from '@react-navigation/native' import { QueryKeyTimeline, useTimelineQuery } from '@utils/queryHooks/timeline' import { getLocalActiveIndex } from '@utils/slices/instancesSlice' import { StyleConstants } from '@utils/styles/constants' +import { useTheme } from '@utils/styles/ThemeManager' import { findIndex } from 'lodash' import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import { FlatListProps, StyleSheet } from 'react-native' +import { + FlatListProps, + Platform, + RefreshControl, + StyleSheet +} from 'react-native' import { FlatList } from 'react-native-gesture-handler' import Animated, { useAnimatedStyle, @@ -45,8 +51,11 @@ const Timeline: React.FC = ({ disableInfinity = false, customProps }) => { + const { theme } = useTheme() + // Update timeline when account switched useSelector(getLocalActiveIndex) + const queryKeyParams = { page, ...(hashtag && { hashtag }), @@ -249,6 +258,22 @@ const Timeline: React.FC = ({ [] ) + const androidRefreshControl = useMemo( + () => + Platform.OS === 'android' && { + refreshControl: ( + refetch()} + /> + ) + }, + [isFetching, isLoading] + ) + return ( <> @@ -273,6 +298,7 @@ const Timeline: React.FC = ({ maintainVisibleContentPosition={{ minIndexForVisible: 0 }} + {...androidRefreshControl} {...customProps} /> diff --git a/src/screens/Compose.tsx b/src/screens/Compose.tsx index 415ebefd..c4e0ce8b 100644 --- a/src/screens/Compose.tsx +++ b/src/screens/Compose.tsx @@ -302,7 +302,7 @@ const ScreenCompose: React.FC = ({ ({ + options={{ stackPresentation: 'modal', - headerShown: false, - headerLeft: () => navigation.pop(1)} /> - })} + headerShown: false + }} /> {sharedScreens(Stack as any)} diff --git a/src/screens/Tabs/Me/Switch.tsx b/src/screens/Tabs/Me/Switch.tsx index 7aab4495..e77b1812 100644 --- a/src/screens/Tabs/Me/Switch.tsx +++ b/src/screens/Tabs/Me/Switch.tsx @@ -26,7 +26,10 @@ const ScreenMeSwitch: React.FC }), headerLeft: () => ( - navigation.goBack()} /> + navigation.goBack()} + /> ) }} />