1
0
mirror of https://github.com/tooot-app/app synced 2025-04-25 07:28:41 +02:00
This commit is contained in:
Zhiyuan Zheng 2021-02-13 12:33:51 +01:00
parent 4c8003b533
commit 0c76fb642d
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
5 changed files with 17 additions and 12 deletions

View File

@ -49,11 +49,12 @@ declare namespace Nav {
} }
| undefined | undefined
'Screen-ImagesViewer': { 'Screen-ImagesViewer': {
imageUrls: (App.IImageInfo & { imageUrls: {
url: Mastodon.AttachmentImage['url']
preview_url: Mastodon.AttachmentImage['preview_url'] preview_url: Mastodon.AttachmentImage['preview_url']
remote_url?: Mastodon.AttachmentImage['remote_url'] remote_url?: Mastodon.AttachmentImage['remote_url']
imageIndex: number imageIndex: number
})[] }[]
imageIndex: number imageIndex: number
} }
} }

View File

@ -37,7 +37,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
const { t } = useTranslation('common') const { t } = useTranslation('common')
const dispatch = useDispatch() const dispatch = useDispatch()
const localActiveIndex = useSelector(getLocalActiveIndex) const localActiveIndex = useSelector(getLocalActiveIndex)
const { mode } = useTheme() const { mode, theme } = useTheme()
enum barStyle { enum barStyle {
light = 'dark-content', light = 'dark-content',
dark = 'light-content' dark = 'light-content'
@ -137,7 +137,7 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
return ( return (
<> <>
<StatusBar barStyle={barStyle[mode]} /> <StatusBar barStyle={barStyle[mode]} backgroundColor={theme.background} />
<NavigationContainer <NavigationContainer
ref={navigationRef} ref={navigationRef}
theme={themes[mode]} theme={themes[mode]}
@ -156,7 +156,8 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
component={ScreenActions} component={ScreenActions}
options={{ options={{
stackPresentation: 'transparentModal', stackPresentation: 'transparentModal',
stackAnimation: 'fade' stackAnimation: 'fade',
headerShown: false // Android
}} }}
/> />
<Stack.Screen <Stack.Screen
@ -164,14 +165,16 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
component={ScreenAnnouncements} component={ScreenAnnouncements}
options={{ options={{
stackPresentation: 'transparentModal', stackPresentation: 'transparentModal',
stackAnimation: 'fade' stackAnimation: 'fade',
headerShown: false // Android
}} }}
/> />
<Stack.Screen <Stack.Screen
name='Screen-Compose' name='Screen-Compose'
component={ScreenCompose} component={ScreenCompose}
options={{ options={{
stackPresentation: 'fullScreenModal' stackPresentation: 'fullScreenModal',
headerShown: false // Android
}} }}
/> />
<Stack.Screen <Stack.Screen
@ -179,7 +182,8 @@ const Screens: React.FC<Props> = ({ localCorrupt }) => {
component={ScreenImagesViewer} component={ScreenImagesViewer}
options={{ options={{
stackPresentation: 'fullScreenModal', stackPresentation: 'fullScreenModal',
stackAnimation: 'fade' stackAnimation: 'fade',
headerShown: false // Android
}} }}
/> />
</Stack.Navigator> </Stack.Navigator>

View File

@ -76,7 +76,7 @@ const Timeline: React.FC<Props> = ({
firstPage.links?.prev && { firstPage.links?.prev && {
min_id: firstPage.links.prev, min_id: firstPage.links.prev,
// https://github.com/facebook/react-native/issues/25239#issuecomment-731100372 // https://github.com/facebook/react-native/issues/25239#issuecomment-731100372
limit: '8' limit: '6'
}, },
getNextPageParam: lastPage => getNextPageParam: lastPage =>

View File

@ -50,8 +50,6 @@ const TimelineAttachment: React.FC<Props> = ({ status }) => {
case 'image': case 'image':
imageUrls.push({ imageUrls.push({
url: attachment.url, url: attachment.url,
width: attachment.meta?.original?.width,
height: attachment.meta?.original?.height,
preview_url: attachment.preview_url, preview_url: attachment.preview_url,
remote_url: attachment.remote_url, remote_url: attachment.remote_url,
imageIndex: index imageIndex: index

View File

@ -12,6 +12,7 @@ import {
PermissionsAndroid, PermissionsAndroid,
Platform, Platform,
Share, Share,
StatusBar,
StyleSheet, StyleSheet,
View View
} from 'react-native' } from 'react-native'
@ -52,7 +53,7 @@ const ScreenImagesViewer = ({
return return
} }
CameraRoll.save( CameraRoll.save(
imageUrls[imageIndex].originUrl || imageUrls[imageIndex].url ||
imageUrls[imageIndex].remote_url || imageUrls[imageIndex].remote_url ||
imageUrls[imageIndex].preview_url imageUrls[imageIndex].preview_url
) )
@ -133,6 +134,7 @@ const ScreenImagesViewer = ({
return ( return (
<SafeAreaView style={styles.base} edges={['top']}> <SafeAreaView style={styles.base} edges={['top']}>
<StatusBar backgroundColor='rgb(0,0,0)' />
<ImageView <ImageView
images={imageUrls.map(urls => ({ uri: urls.url }))} images={imageUrls.map(urls => ({ uri: urls.url }))}
imageIndex={imageIndex} imageIndex={imageIndex}