ci: add iOS OTA publishing and refactor gesture handling
- Add `ota-ios` job to GitHub Actions workflow to support iOS OTA updates - Refactor `ScheduleScreen` to use `GestureDetector` and `Gesture` from `react-native-gesture-handler` instead of `PanGestureHandler` - Update `TradeCard` styles and layout spacing in `HomeScreen` and `MarketView` - Refactor `MarketView` to use updated responsive spacing values
This commit is contained in:
@@ -796,7 +796,7 @@ export const HomeScreen: React.FC = () => {
|
||||
const authorId = item.author?.id || '';
|
||||
const isPostAuthor = currentUser?.id === authorId;
|
||||
return (
|
||||
<View style={styles.gridItem}>
|
||||
<View style={{ marginBottom: 2, paddingHorizontal: 1 }}>
|
||||
<PostCard
|
||||
post={item}
|
||||
variant="grid"
|
||||
|
||||
@@ -53,8 +53,8 @@ export function MarketView({
|
||||
const isAuth = useIsAuthenticated();
|
||||
const { width } = useResponsive();
|
||||
|
||||
const gap = useResponsiveSpacing({ xs: 6, sm: 8, md: 10, lg: 12, xl: 16 });
|
||||
const padding = useResponsiveSpacing({ xs: 8, sm: 10, md: 12, lg: 16, xl: 20 });
|
||||
const gap = useResponsiveSpacing({ xs: 4, sm: 6, md: 8, lg: 12, xl: 16 });
|
||||
const padding = useResponsiveSpacing({ xs: 8, sm: 12, md: 16, lg: 24, xl: 32 });
|
||||
const styles = useMemo(() => createMarketStyles(colors, gap, padding), [colors, gap, padding]);
|
||||
|
||||
const [items, setItems] = useState<TradeItemDTO[]>([]);
|
||||
@@ -163,7 +163,7 @@ export function MarketView({
|
||||
}, [items, isAuth]);
|
||||
|
||||
const renderItem = useCallback<ListRenderItem<TradeItemDTO>>(({ item }) => (
|
||||
<View style={{ marginBottom: gap }}>
|
||||
<View style={{ marginBottom: 2, paddingHorizontal: 1 }}>
|
||||
<TradeCard
|
||||
item={item}
|
||||
variant="grid"
|
||||
@@ -171,7 +171,7 @@ export function MarketView({
|
||||
onFavorite={handleFavorite}
|
||||
/>
|
||||
</View>
|
||||
), [handlePressItem, handleFavorite, gap]);
|
||||
), [handlePressItem, handleFavorite]);
|
||||
|
||||
const keyExtractor = useCallback((item: TradeItemDTO) => item.id, []);
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ import {
|
||||
ActivityIndicator,
|
||||
Platform,
|
||||
} from 'react-native';
|
||||
import { PanGestureHandler, State } from 'react-native-gesture-handler';
|
||||
import type { PanGestureHandlerStateChangeEvent } from 'react-native-gesture-handler';
|
||||
import { GestureDetector, Gesture } from 'react-native-gesture-handler';
|
||||
import { runOnJS } from 'react-native-reanimated';
|
||||
import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { MaterialCommunityIcons } from '@expo/vector-icons';
|
||||
import { blurActiveElement } from '../../infrastructure/platform';
|
||||
@@ -305,20 +305,23 @@ export const ScheduleScreen: React.FC = () => {
|
||||
[courses]
|
||||
);
|
||||
|
||||
const handleWeekSwipe = useCallback(
|
||||
({ nativeEvent }: PanGestureHandlerStateChangeEvent) => {
|
||||
if (nativeEvent.oldState !== State.ACTIVE && nativeEvent.oldState !== State.BEGAN) return;
|
||||
const { translationX, translationY } = nativeEvent;
|
||||
if (Math.abs(translationX) < SWIPE_THRESHOLD) return;
|
||||
if (Math.abs(translationX) <= Math.abs(translationY) * 0.8) return;
|
||||
const goNextWeek = useCallback(() => setCurrentWeek(prev => Math.min(prev + 1, weeks.length)), [weeks.length]);
|
||||
const goPrevWeek = useCallback(() => setCurrentWeek(prev => Math.max(prev - 1, 1)), [weeks.length]);
|
||||
|
||||
if (translationX < 0) {
|
||||
setCurrentWeek(prev => Math.min(prev + 1, weeks.length));
|
||||
} else {
|
||||
setCurrentWeek(prev => Math.max(prev - 1, 1));
|
||||
}
|
||||
},
|
||||
[weeks.length]
|
||||
const weekSwipeGesture = useMemo(() =>
|
||||
Gesture.Pan()
|
||||
.activeOffsetX([-8, 8])
|
||||
.failOffsetY([-80, 80])
|
||||
.onEnd((e) => {
|
||||
if (Math.abs(e.translationX) < SWIPE_THRESHOLD) return;
|
||||
if (Math.abs(e.translationX) <= Math.abs(e.translationY) * 0.8) return;
|
||||
if (e.translationX < 0) {
|
||||
runOnJS(goNextWeek)();
|
||||
} else {
|
||||
runOnJS(goPrevWeek)();
|
||||
}
|
||||
}),
|
||||
[goNextWeek, goPrevWeek]
|
||||
);
|
||||
|
||||
const webTouchStartRef = useRef<{ x: number; y: number; time: number } | null>(null);
|
||||
@@ -797,11 +800,7 @@ export const ScheduleScreen: React.FC = () => {
|
||||
</ScrollView>
|
||||
</View>
|
||||
) : (
|
||||
<PanGestureHandler
|
||||
activeOffsetX={[-8, 8]}
|
||||
failOffsetY={[-80, 80]}
|
||||
onHandlerStateChange={handleWeekSwipe}
|
||||
>
|
||||
<GestureDetector gesture={weekSwipeGesture}>
|
||||
<View style={styles.scheduleBodyGestureLayer}>
|
||||
<ScrollView
|
||||
style={styles.scheduleBody}
|
||||
@@ -809,21 +808,14 @@ export const ScheduleScreen: React.FC = () => {
|
||||
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>
|
||||
<View style={styles.daysContainer}>
|
||||
{VISIBLE_DAY_VALUES.map((dayOfWeek, index) =>
|
||||
renderDayColumn(dayOfWeek, index, index === VISIBLE_DAY_VALUES.length - 1)
|
||||
)}
|
||||
</View>
|
||||
</ScrollView>
|
||||
</View>
|
||||
</PanGestureHandler>
|
||||
</GestureDetector>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user