1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Using tab-view

Cannot scroll separately
This commit is contained in:
Zhiyuan Zheng
2020-12-17 09:44:03 +01:00
parent a3335a1f88
commit 3427b613aa
15 changed files with 462 additions and 173 deletions

View File

@ -90,7 +90,7 @@ export type ComposeState = {
}
}
export type PostAction =
export type ComposeAction =
| {
type: 'spoiler'
payload: Partial<ComposeState['spoiler']>
@ -251,7 +251,10 @@ const composeExistingState = ({
}
}
}
const postReducer = (state: ComposeState, action: PostAction): ComposeState => {
const composeReducer = (
state: ComposeState,
action: ComposeAction
): ComposeState => {
switch (action.type) {
case 'spoiler':
return { ...state, spoiler: { ...state.spoiler, ...action.payload } }
@ -294,7 +297,7 @@ const postReducer = (state: ComposeState, action: PostAction): ComposeState => {
type ContextType = {
composeState: ComposeState
composeDispatch: Dispatch<PostAction>
composeDispatch: Dispatch<ComposeAction>
}
export const ComposeContext = createContext<ContextType>({} as ContextType)
@ -332,7 +335,7 @@ const Compose: React.FC<Props> = ({ route: { params }, navigation }) => {
}
const [composeState, composeDispatch] = useReducer(
postReducer,
composeReducer,
params?.type && params?.incomingStatus
? composeExistingState({
type: params.type,