mirror of https://github.com/tooot-app/app
Fix crashes
This commit is contained in:
parent
a0321291aa
commit
e619677660
|
@ -4,7 +4,7 @@
|
||||||
"native": "220214",
|
"native": "220214",
|
||||||
"major": 3,
|
"major": 3,
|
||||||
"minor": 5,
|
"minor": 5,
|
||||||
"patch": 2,
|
"patch": 3,
|
||||||
"expo": "44.0.0"
|
"expo": "44.0.0"
|
||||||
},
|
},
|
||||||
"description": "tooot app for Mastodon",
|
"description": "tooot app for Mastodon",
|
||||||
|
|
|
@ -37,7 +37,7 @@ const TimelineAvatar = React.memo(
|
||||||
})
|
})
|
||||||
})}
|
})}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
uri={{ original: account.avatar, static: account.avatar_static }}
|
uri={{ original: account?.avatar, static: account?.avatar_static }}
|
||||||
dimension={{
|
dimension={{
|
||||||
width: StyleConstants.Avatar.M,
|
width: StyleConstants.Avatar.M,
|
||||||
height: StyleConstants.Avatar.M
|
height: StyleConstants.Avatar.M
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { QueryKeyTimeline } from '@utils/queryHooks/timeline'
|
||||||
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import { FlatList } from 'react-native'
|
import { FlatList } from 'react-native'
|
||||||
import { InfiniteQueryObserver, useQueryClient } from 'react-query'
|
import { InfiniteQueryObserver, useQueryClient } from 'react-query'
|
||||||
import * as Sentry from 'sentry-expo'
|
|
||||||
|
|
||||||
const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
route: {
|
route: {
|
||||||
|
@ -45,25 +44,15 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
scrolled.current = true
|
scrolled.current = true
|
||||||
const pointer = flattenData.findIndex(({ id }) => id === toot.id)
|
const pointer = flattenData.findIndex(({ id }) => id === toot.id)
|
||||||
if (pointer < 1) return
|
if (pointer < 1) return
|
||||||
Sentry.Native.setContext('Scroll to Index', {
|
|
||||||
type: 'original',
|
|
||||||
index: pointer,
|
|
||||||
itemsLength: flattenData.length,
|
|
||||||
id: toot.id,
|
|
||||||
flattenData: flattenData.map(({ id }) => id)
|
|
||||||
})
|
|
||||||
try {
|
try {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
console.log('scrolling')
|
||||||
flRef.current?.scrollToIndex({
|
flRef.current?.scrollToIndex({
|
||||||
index: pointer,
|
index: pointer,
|
||||||
viewOffset: 100
|
viewOffset: 100
|
||||||
})
|
})
|
||||||
}, 500)
|
}, 500)
|
||||||
} catch (err) {
|
} catch {}
|
||||||
if (Math.random() < 0.05) {
|
|
||||||
Sentry.Native.captureException(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -74,12 +63,6 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
error => {
|
error => {
|
||||||
const offset = error.averageItemLength * error.index
|
const offset = error.averageItemLength * error.index
|
||||||
flRef.current?.scrollToOffset({ offset })
|
flRef.current?.scrollToOffset({ offset })
|
||||||
Sentry.Native.setContext('Scroll to Index', {
|
|
||||||
type: 'onScrollToIndexFailed',
|
|
||||||
index: error.index,
|
|
||||||
itemsLength,
|
|
||||||
id: toot.id
|
|
||||||
})
|
|
||||||
try {
|
try {
|
||||||
error.index < itemsLength &&
|
error.index < itemsLength &&
|
||||||
setTimeout(
|
setTimeout(
|
||||||
|
@ -90,11 +73,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
}),
|
}),
|
||||||
500
|
500
|
||||||
)
|
)
|
||||||
} catch (err) {
|
} catch {}
|
||||||
if (Math.random() < 0.05) {
|
|
||||||
Sentry.Native.captureException(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[itemsLength]
|
[itemsLength]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue