feat(Comment): enhance like functionality for comments and replies
- Updated CommentItem component to accept the comment object in the onLike callback, allowing for more detailed like handling. - Added a like button for replies, improving user interaction with nested comments. - Refactored handleLikeComment function in PostDetailScreen for optimized state management and error handling during like operations. - Enhanced SettingsScreen to provide debug information for theme preferences, improving user experience in theme selection. - Updated themeStore to dynamically manage system theme changes and improve overall theme handling.
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
borderRadius,
|
||||
useThemePreference,
|
||||
useSetThemePreference,
|
||||
useThemeStore,
|
||||
type AppColors,
|
||||
} from '../../theme';
|
||||
import { useAuthStore } from '../../stores';
|
||||
@@ -204,29 +205,41 @@ export const SettingsScreen: React.FC = () => {
|
||||
|
||||
const handleItemPress = (key: string) => {
|
||||
switch (key) {
|
||||
case 'theme':
|
||||
Alert.alert('主题模式', '选择应用界面明暗', [
|
||||
{ text: '取消', style: 'cancel' },
|
||||
{
|
||||
text: '跟随系统',
|
||||
onPress: () => {
|
||||
void setThemePreference('system');
|
||||
case 'theme': {
|
||||
// 获取调试信息
|
||||
const { Appearance } = require('react-native');
|
||||
const systemScheme = Appearance?.getColorScheme?.() || 'undefined';
|
||||
const resolvedScheme = useThemeStore.getState().resolvedScheme;
|
||||
const storedPref = useThemeStore.getState().preference;
|
||||
const storedSystem = useThemeStore.getState().systemScheme;
|
||||
|
||||
Alert.alert(
|
||||
'主题模式',
|
||||
`选择应用界面明暗\n\n[调试信息]\n系统主题: ${systemScheme}\n存储偏好: ${storedPref}\n存储系统: ${storedSystem}\n实际应用: ${resolvedScheme}`,
|
||||
[
|
||||
{ text: '取消', style: 'cancel' },
|
||||
{
|
||||
text: '跟随系统',
|
||||
onPress: () => {
|
||||
void setThemePreference('system');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '浅色',
|
||||
onPress: () => {
|
||||
void setThemePreference('light');
|
||||
{
|
||||
text: '浅色',
|
||||
onPress: () => {
|
||||
void setThemePreference('light');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
text: '深色',
|
||||
onPress: () => {
|
||||
void setThemePreference('dark');
|
||||
{
|
||||
text: '深色',
|
||||
onPress: () => {
|
||||
void setThemePreference('dark');
|
||||
},
|
||||
},
|
||||
},
|
||||
]);
|
||||
]
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'edit_profile':
|
||||
router.push(hrefs.hrefProfileEdit());
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user