chore: remove IDE config files and improve web platform compatibility
All checks were successful
Frontend CI / build-and-push-web (push) Successful in 2m31s
Frontend CI / ota-android (push) Successful in 10m26s
Frontend CI / build-android-apk (push) Successful in 40m43s

- Remove `.idea/` IntelliJ configuration files from version control
- Add web-specific touch handling for swipeable message bubbles and schedule screen
- Fix CSS touch-action rules for better web scrolling behavior
- Add nestedScrollEnabled to ScrollViews for proper gesture handling
- Improve null safety checks in profile screens
- Add horizontal ScrollView wrapper for notification filter tags
- Add hasHeader prop support for embedded profile screens
This commit is contained in:
lafay
2026-04-14 02:12:53 +08:00
parent 57d7c7405c
commit c00b915e5f
18 changed files with 262 additions and 583 deletions

View File

@@ -302,6 +302,30 @@ export const ScheduleScreen: React.FC = () => {
[weeks.length]
);
const webTouchStartRef = useRef<{ x: number; y: number; time: number } | null>(null);
const handleWebTouchStart = useCallback((e: any) => {
const touch = e.nativeEvent?.touches?.[0] || e.nativeEvent;
if (touch && touch.pageX !== undefined) {
webTouchStartRef.current = { x: touch.pageX, y: touch.pageY, time: Date.now() };
}
}, []);
const handleWebTouchEnd = useCallback((e: any) => {
const start = webTouchStartRef.current;
if (!start) return;
webTouchStartRef.current = null;
const touch = e.nativeEvent?.changedTouches?.[0] || e.nativeEvent;
if (!touch || touch.pageX === undefined) return;
const dx = touch.pageX - start.x;
const dy = touch.pageY - start.y;
if (Math.abs(dx) < SWIPE_THRESHOLD) return;
if (Math.abs(dx) <= Math.abs(dy) * 0.8) return;
if (dx < 0) {
setCurrentWeek(prev => Math.min(prev + 1, weeks.length));
} else {
setCurrentWeek(prev => Math.max(prev - 1, 1));
}
}, [weeks.length]);
const isSlotOccupied = useCallback(
(dayOfWeek: number, mergedSection: number, weekCourses: Course[]) => {
return weekCourses.some(course => {
@@ -713,16 +737,20 @@ export const ScheduleScreen: React.FC = () => {
// 渲染课程表主体
const renderScheduleBody = () => {
// 移动端和电脑端都不添加额外底部间距,让内容填满整个区域
// 动态计算的高度已经确保第六节课显示在正确位置
const gestureLayerProps = Platform.OS === 'web'
? {
onTouchStart: handleWebTouchStart,
onTouchEnd: handleWebTouchEnd,
'data-gesture-area': true,
}
: {};
return (
<PanGestureHandler
activeOffsetX={[-8, 8]}
failOffsetY={[-80, 80]}
onHandlerStateChange={handleWeekSwipe}
>
<View style={styles.scheduleBodyGestureLayer}>
Platform.OS === 'web' ? (
<View
style={styles.scheduleBodyGestureLayer}
{...gestureLayerProps}
>
<ScrollView
style={styles.scheduleBody}
showsVerticalScrollIndicator={false}
@@ -732,6 +760,7 @@ export const ScheduleScreen: React.FC = () => {
<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
nestedScrollEnabled
contentContainerStyle={{ flexGrow: 1 }}
>
<View style={styles.daysContainer}>
@@ -742,7 +771,35 @@ export const ScheduleScreen: React.FC = () => {
</ScrollView>
</ScrollView>
</View>
</PanGestureHandler>
) : (
<PanGestureHandler
activeOffsetX={[-8, 8]}
failOffsetY={[-80, 80]}
onHandlerStateChange={handleWeekSwipe}
>
<View style={styles.scheduleBodyGestureLayer}>
<ScrollView
style={styles.scheduleBody}
showsVerticalScrollIndicator={false}
contentContainerStyle={styles.scheduleBodyContent}
>
{renderTimeColumn()}
<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
nestedScrollEnabled
contentContainerStyle={{ flexGrow: 1 }}
>
<View style={styles.daysContainer}>
{VISIBLE_DAY_VALUES.map((dayOfWeek, index) =>
renderDayColumn(dayOfWeek, index, index === VISIBLE_DAY_VALUES.length - 1)
)}
</View>
</ScrollView>
</ScrollView>
</View>
</PanGestureHandler>
)
);
};