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
build_android_app(
task: 'assemble',
build_type: 'debug',
build_type: 'release',
project_dir: "./android"
)
adb(

View File

@ -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<Props> = ({
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<Props> = ({
[]
)
const androidRefreshControl = useMemo(
() =>
Platform.OS === 'android' && {
refreshControl: (
<RefreshControl
enabled
colors={[theme.primary]}
progressBackgroundColor={theme.background}
refreshing={isFetching || isLoading}
// onRefresh={() => refetch()}
/>
)
},
[isFetching, isLoading]
)
return (
<>
<TimelineRefresh isLoading={isLoading} disable={disableRefresh} />
@ -273,6 +298,7 @@ const Timeline: React.FC<Props> = ({
maintainVisibleContentPosition={{
minIndexForVisible: 0
}}
{...androidRefreshControl}
{...customProps}
/>
</>

View File

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

View File

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

View File

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