Hide header bottom shadow

This commit is contained in:
Zhiyuan Zheng 2020-12-25 21:51:46 +01:00
parent 087f50577f
commit 9d1c366eda
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
9 changed files with 23 additions and 12 deletions

View File

@ -5,7 +5,7 @@ import {
NavigationContainerRef NavigationContainerRef
} from '@react-navigation/native' } from '@react-navigation/native'
import React, { useEffect, useMemo, useRef } from 'react' import React, { useEffect, useRef } from 'react'
import { StatusBar } from 'react-native' import { StatusBar } from 'react-native'
import Toast from 'react-native-toast-message' import Toast from 'react-native-toast-message'
import { Feather } from '@expo/vector-icons' import { Feather } from '@expo/vector-icons'
@ -27,8 +27,7 @@ import {
updateLocalAccountPreferences, updateLocalAccountPreferences,
updateNotification updateNotification
} from '@utils/slices/instancesSlice' } from '@utils/slices/instancesSlice'
import { useInfiniteQuery, useQuery } from 'react-query' import { useInfiniteQuery } from 'react-query'
import { announcementFetch } from './utils/fetches/announcementsFetch'
import client from './api/client' import client from './api/client'
import { timelineFetch } from './utils/fetches/timelineFetch' import { timelineFetch } from './utils/fetches/timelineFetch'
@ -80,7 +79,9 @@ export const Index: React.FC<Props> = ({ localCorrupt }) => {
}) })
.then(({ body }: { body?: Mastodon.Announcement[] }) => { .then(({ body }: { body?: Mastodon.Announcement[] }) => {
if (body?.filter(announcement => !announcement.read).length) { if (body?.filter(announcement => !announcement.read).length) {
navigationRef.current?.navigate('Screen-Shared-Announcements') navigationRef.current?.navigate('Screen-Shared-Announcements', {
showAll: false
})
} }
}) })
.catch(() => {}) .catch(() => {})

View File

@ -67,7 +67,7 @@ const Timelines: React.FC<Props> = ({ name, content }) => {
) )
return ( return (
<Stack.Navigator> <Stack.Navigator screenOptions={{ headerHideShadow: true }}>
<Stack.Screen <Stack.Screen
name={name} name={name}
options={{ options={{

View File

@ -133,9 +133,9 @@ const Timeline: React.FC<Props> = ({
() => <TimelineEmpty status={status} refetch={refetch} />, () => <TimelineEmpty status={status} refetch={refetch} />,
[status] [status]
) )
const onEndReached = useCallback(() => fetchNextPage(), []) const onEndReached = useCallback(() => !disableRefresh && fetchNextPage(), [])
const ListFooterComponent = useCallback( const ListFooterComponent = useCallback(
() => <TimelineEnd hasNextPage={hasNextPage} />, () => <TimelineEnd hasNextPage={!disableRefresh ? hasNextPage : false} />,
[hasNextPage] [hasNextPage]
) )
const refreshControl = useMemo( const refreshControl = useMemo(

View File

@ -19,7 +19,7 @@ const ScreenMe: React.FC = () => {
const { t } = useTranslation() const { t } = useTranslation()
return ( return (
<Stack.Navigator> <Stack.Navigator screenOptions={{ headerHideShadow: true }}>
<Stack.Screen <Stack.Screen
name='Screen-Me-Root' name='Screen-Me-Root'
component={ScreenMeRoot} component={ScreenMeRoot}

View File

@ -24,7 +24,10 @@ const ScreenNotifications: React.FC = () => {
return ( return (
<Stack.Navigator <Stack.Navigator
screenOptions={{ headerTitle: t('notifications:heading') }} screenOptions={{
headerTitle: t('notifications:heading'),
headerHideShadow: true
}}
> >
<Stack.Screen name='Screen-Notifications-Root'> <Stack.Screen name='Screen-Notifications-Root'>
{() => (localRegistered ? <Timeline page='Notifications' /> : null)} {() => (localRegistered ? <Timeline page='Notifications' /> : null)}

View File

@ -3,6 +3,7 @@ import client from '@root/api/client'
import { ButtonRow } from '@root/components/Button' import { ButtonRow } from '@root/components/Button'
import ParseContent from '@root/components/ParseContent' import ParseContent from '@root/components/ParseContent'
import { announcementFetch } from '@root/utils/fetches/announcementsFetch' import { announcementFetch } from '@root/utils/fetches/announcementsFetch'
import relativeTime from '@root/utils/relativeTime'
import { StyleConstants } from '@root/utils/styles/constants' import { StyleConstants } from '@root/utils/styles/constants'
import { useTheme } from '@root/utils/styles/ThemeManager' import { useTheme } from '@root/utils/styles/ThemeManager'
import React, { useCallback, useEffect, useState } from 'react' import React, { useCallback, useEffect, useState } from 'react'
@ -90,6 +91,9 @@ const ScreenSharedAnnouncements: React.FC = ({
} }
]} ]}
> >
<Text style={[styles.published, { color: theme.secondary }]}>
{relativeTime(item.published_at)}
</Text>
<ScrollView style={styles.scrollView} showsVerticalScrollIndicator> <ScrollView style={styles.scrollView} showsVerticalScrollIndicator>
<ParseContent <ParseContent
content={item.content} content={item.content}
@ -220,6 +224,10 @@ const styles = StyleSheet.create({
padding: StyleConstants.Spacing.Global.PagePadding, padding: StyleConstants.Spacing.Global.PagePadding,
justifyContent: 'center' justifyContent: 'center'
}, },
published: {
fontSize: StyleConstants.Font.Size.S,
marginBottom: StyleConstants.Spacing.S
},
pressable: { ...StyleSheet.absoluteFillObject }, pressable: { ...StyleSheet.absoluteFillObject },
announcement: { announcement: {
flexShrink: 1, flexShrink: 1,

View File

@ -224,7 +224,7 @@ const ComposeEditAttachment: React.FC<Props> = ({
return ( return (
<KeyboardAvoidingView behavior='padding' style={{ flex: 1 }}> <KeyboardAvoidingView behavior='padding' style={{ flex: 1 }}>
<SafeAreaView style={{ flex: 1 }} edges={['right', 'bottom', 'left']}> <SafeAreaView style={{ flex: 1 }} edges={['right', 'bottom', 'left']}>
<Stack.Navigator> <Stack.Navigator screenOptions={{ headerHideShadow: true }}>
<Stack.Screen <Stack.Screen
name='Screen-Shared-Compose-EditAttachment-Root' name='Screen-Shared-Compose-EditAttachment-Root'
options={{ options={{

View File

@ -85,7 +85,7 @@ const ScreenSharedImagesViewer: React.FC<Props> = ({
[] []
) )
return ( return (
<Stack.Navigator> <Stack.Navigator screenOptions={{ headerHideShadow: true }}>
<Stack.Screen <Stack.Screen
name='Screen-Shared-ImagesViewer-Root' name='Screen-Shared-ImagesViewer-Root'
component={component} component={component}

View File

@ -117,7 +117,6 @@ export const timelineFetch = async ({
toots = uniqBy([...toots, ...res.body], 'id') toots = uniqBy([...toots, ...res.body], 'id')
return Promise.resolve({ toots: toots, pinnedLength }) return Promise.resolve({ toots: toots, pinnedLength })
} }
break
case 'Account_All': case 'Account_All':
res = await client({ res = await client({