Fix android screens

This commit is contained in:
Zhiyuan Zheng 2021-02-13 13:08:34 +01:00
parent 0c76fb642d
commit a9326c381a
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
5 changed files with 36 additions and 8 deletions

View File

@ -100,7 +100,7 @@ private_lane :build_android do
if !is_ci if !is_ci
build_android_app( build_android_app(
task: 'assemble', task: 'assemble',
build_type: 'debug', build_type: 'release',
project_dir: "./android" project_dir: "./android"
) )
adb( adb(

View File

@ -3,9 +3,15 @@ import { useNavigation, useScrollToTop } from '@react-navigation/native'
import { QueryKeyTimeline, useTimelineQuery } from '@utils/queryHooks/timeline' import { QueryKeyTimeline, useTimelineQuery } from '@utils/queryHooks/timeline'
import { getLocalActiveIndex } from '@utils/slices/instancesSlice' import { getLocalActiveIndex } from '@utils/slices/instancesSlice'
import { StyleConstants } from '@utils/styles/constants' import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import { findIndex } from 'lodash' import { findIndex } from 'lodash'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' 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 { FlatList } from 'react-native-gesture-handler'
import Animated, { import Animated, {
useAnimatedStyle, useAnimatedStyle,
@ -45,8 +51,11 @@ const Timeline: React.FC<Props> = ({
disableInfinity = false, disableInfinity = false,
customProps customProps
}) => { }) => {
const { theme } = useTheme()
// Update timeline when account switched // Update timeline when account switched
useSelector(getLocalActiveIndex) useSelector(getLocalActiveIndex)
const queryKeyParams = { const queryKeyParams = {
page, page,
...(hashtag && { hashtag }), ...(hashtag && { hashtag }),
@ -249,6 +258,22 @@ const Timeline: React.FC<Props> = ({
[] []
) )
const androidRefreshControl = useMemo(
() =>
Platform.OS === 'android' && {
refreshControl: (
<RefreshControl
enabled
colors={[theme.primary]}
progressBackgroundColor={theme.background}
refreshing={isFetching || isLoading}
// onRefresh={() => refetch()}
/>
)
},
[isFetching, isLoading]
)
return ( return (
<> <>
<TimelineRefresh isLoading={isLoading} disable={disableRefresh} /> <TimelineRefresh isLoading={isLoading} disable={disableRefresh} />
@ -273,6 +298,7 @@ const Timeline: React.FC<Props> = ({
maintainVisibleContentPosition={{ maintainVisibleContentPosition={{
minIndexForVisible: 0 minIndexForVisible: 0
}} }}
{...androidRefreshControl}
{...customProps} {...customProps}
/> />
</> </>

View File

@ -302,7 +302,7 @@ const ScreenCompose: React.FC<ScreenComposeProp> = ({
<KeyboardAvoidingView <KeyboardAvoidingView
style={styles.base} style={styles.base}
behavior={Platform.OS === 'ios' ? 'padding' : 'height'} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
keyboardVerticalOffset={Platform.OS === 'android' ? 23 : 0} keyboardVerticalOffset={Platform.OS === 'android' ? 63 : 0}
> >
<SafeAreaView <SafeAreaView
style={styles.base} style={styles.base}

View File

@ -117,11 +117,10 @@ const TabMe = React.memo(
<Stack.Screen <Stack.Screen
name='Tab-Me-Switch' name='Tab-Me-Switch'
component={ScreenMeSwitch} component={ScreenMeSwitch}
options={({ navigation }: any) => ({ options={{
stackPresentation: 'modal', stackPresentation: 'modal',
headerShown: false, headerShown: false
headerLeft: () => <HeaderLeft onPress={() => navigation.pop(1)} /> }}
})}
/> />
{sharedScreens(Stack as any)} {sharedScreens(Stack as any)}

View File

@ -26,7 +26,10 @@ const ScreenMeSwitch: React.FC<StackScreenProps<
headerCenter: () => <HeaderCenter content={t('meSwitch:heading')} /> headerCenter: () => <HeaderCenter content={t('meSwitch:heading')} />
}), }),
headerLeft: () => ( headerLeft: () => (
<HeaderLeft content='X' onPress={() => navigation.goBack()} /> <HeaderLeft
content='ChevronDown'
onPress={() => navigation.goBack()}
/>
) )
}} }}
/> />