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
'Screen-ImagesViewer': {
imageUrls: (App.IImageInfo & {
imageUrls: {
url: Mastodon.AttachmentImage['url']
preview_url: Mastodon.AttachmentImage['preview_url']
remote_url?: Mastodon.AttachmentImage['remote_url']
imageIndex: number
})[]
}[]
imageIndex: number
}
}

View File

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

View File

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

View File

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

View File

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