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

@ -2,7 +2,6 @@ import React from 'react'
import {StyleProp, View, ViewStyle} from 'react-native'
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {toShareUrl} from 'lib/strings/url-helpers'
import {useStores} from 'state/index'
import {useTheme} from 'lib/ThemeContext'
import {shareUrl} from 'lib/sharing'
import {
@ -10,6 +9,7 @@ import {
DropdownItem as NativeDropdownItem,
} from './NativeDropdown'
import {EventStopper} from '../EventStopper'
import {useModalControls} from '#/state/modals'
export function PostDropdownBtn({
testID,
@ -37,9 +37,9 @@ export function PostDropdownBtn({
onDeletePost: () => void
style?: StyleProp<ViewStyle>
}) {
const store = useStores()
const theme = useTheme()
const defaultCtrlColor = theme.palette.default.postCtrl
const {openModal} = useModalControls()
const dropdownItems: NativeDropdownItem[] = [
{
@ -108,7 +108,7 @@ export function PostDropdownBtn({
!isAuthor && {
label: 'Report post',
onPress() {
store.shell.openModal({
openModal({
name: 'report',
uri: itemUri,
cid: itemCid,
@ -129,7 +129,7 @@ export function PostDropdownBtn({
isAuthor && {
label: 'Delete post',
onPress() {
store.shell.openModal({
openModal({
name: 'confirm',
title: 'Delete this post?',
message: 'Are you sure? This can not be undone.',