修复了课程表和发帖按钮
This commit is contained in:
@@ -33,6 +33,11 @@ import VoteEditor from '../../components/business/VoteEditor';
|
||||
import { useResponsive, useResponsiveValue } from '../../hooks';
|
||||
import { RootStackParamList } from '../../navigation/types';
|
||||
|
||||
// Props 接口
|
||||
interface CreatePostScreenProps {
|
||||
onClose?: () => void;
|
||||
}
|
||||
|
||||
const MAX_TITLE_LENGTH = 100;
|
||||
const MAX_CONTENT_LENGTH = 2000;
|
||||
|
||||
@@ -73,7 +78,8 @@ const getPublishErrorMessage = (error: unknown): string => {
|
||||
return '发布失败,请重试';
|
||||
};
|
||||
|
||||
export const CreatePostScreen: React.FC = () => {
|
||||
export const CreatePostScreen: React.FC<CreatePostScreenProps> = (props) => {
|
||||
const { onClose } = props;
|
||||
const navigation = useNavigation();
|
||||
const route = useRoute<RouteProp<RootStackParamList, 'CreatePost'>>();
|
||||
const isEditMode = route.params?.mode === 'edit' && !!route.params?.postId;
|
||||
@@ -130,8 +136,14 @@ export const CreatePostScreen: React.FC = () => {
|
||||
React.useLayoutEffect(() => {
|
||||
navigation.setOptions({
|
||||
title: isEditMode ? '编辑帖子' : '发布帖子',
|
||||
// 当作为 Modal 使用时,显示关闭按钮
|
||||
headerLeft: onClose ? () => (
|
||||
<TouchableOpacity onPress={onClose} style={{ padding: 8 }}>
|
||||
<MaterialCommunityIcons name="close" size={24} color={colors.text.primary} />
|
||||
</TouchableOpacity>
|
||||
) : undefined,
|
||||
});
|
||||
}, [navigation, isEditMode]);
|
||||
}, [navigation, isEditMode, onClose]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!isEditMode || !editPostID) {
|
||||
|
||||
Reference in New Issue
Block a user