Add modal state provider, replace usage except methods (#1833)

* Add modal state provider, replace usage except methods

* Replace easy spots

* Fix sticky spots

* Replace final usages

* Memorize context objects

* Add more warnings
This commit is contained in:
Eric Bailey 2023-11-08 12:34:10 -06:00 committed by GitHub
parent 5eadadffbf
commit f18b15241a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 634 additions and 498 deletions

View file

@ -5,8 +5,8 @@ import {s, colors} from 'lib/styles'
import {useTheme} from 'lib/ThemeContext'
import {Text} from '../text/Text'
import {pluralize} from 'lib/strings/helpers'
import {useStores} from 'state/index'
import {HITSLOP_10, HITSLOP_20} from 'lib/constants'
import {useModalControls} from '#/state/modals'
interface Props {
isReposted: boolean
@ -23,8 +23,8 @@ export const RepostButton = ({
onRepost,
onQuote,
}: Props) => {
const store = useStores()
const theme = useTheme()
const {openModal} = useModalControls()
const defaultControlColor = React.useMemo(
() => ({
@ -34,13 +34,13 @@ export const RepostButton = ({
)
const onPressToggleRepostWrapper = useCallback(() => {
store.shell.openModal({
openModal({
name: 'repost',
onRepost: onRepost,
onQuote: onQuote,
isReposted,
})
}, [onRepost, onQuote, isReposted, store.shell])
}, [onRepost, onQuote, isReposted, openModal])
return (
<TouchableOpacity