Remove deprecated models and mobx usage (react-query refactor) (#1934)
* Update login page to use service query * Update modal to use session instead of store * Move image sizes cache off store * Update settings to no longer use store * Update link-meta fetch to use agent instead of rootstore * Remove deprecated resolveName() * Delete deprecated link-metas cache * Delete deprecated posts cache * Delete all remaining mobx models, including the root store * Strip out unused mobx observer wrappers
This commit is contained in:
parent
e637798e05
commit
54faa7e176
81 changed files with 1084 additions and 1941 deletions
|
@ -2,8 +2,8 @@ import React from 'react'
|
|||
import {StyleProp, StyleSheet, Pressable, View, ViewStyle} from 'react-native'
|
||||
import {Image} from 'expo-image'
|
||||
import {clamp} from 'lib/numbers'
|
||||
import {useStores} from 'state/index'
|
||||
import {Dimensions} from 'lib/media/types'
|
||||
import * as imageSizes from 'lib/media/image-sizes'
|
||||
|
||||
const MIN_ASPECT_RATIO = 0.33 // 1/3
|
||||
const MAX_ASPECT_RATIO = 5 // 5/1
|
||||
|
@ -29,9 +29,8 @@ export function AutoSizedImage({
|
|||
style,
|
||||
children = null,
|
||||
}: Props) {
|
||||
const store = useStores()
|
||||
const [dim, setDim] = React.useState<Dimensions | undefined>(
|
||||
dimensionsHint || store.imageSizes.get(uri),
|
||||
dimensionsHint || imageSizes.get(uri),
|
||||
)
|
||||
const [aspectRatio, setAspectRatio] = React.useState<number>(
|
||||
dim ? calc(dim) : 1,
|
||||
|
@ -41,14 +40,14 @@ export function AutoSizedImage({
|
|||
if (dim) {
|
||||
return
|
||||
}
|
||||
store.imageSizes.fetch(uri).then(newDim => {
|
||||
imageSizes.fetch(uri).then(newDim => {
|
||||
if (aborted) {
|
||||
return
|
||||
}
|
||||
setDim(newDim)
|
||||
setAspectRatio(calc(newDim))
|
||||
})
|
||||
}, [dim, setDim, setAspectRatio, store, uri])
|
||||
}, [dim, setDim, setAspectRatio, uri])
|
||||
|
||||
if (onPress || onLongPress || onPressIn) {
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue