Zoom and panning are basic functionalities for galleries, maps, and viewers in mobile apps. However, incorrect gesture handling spoils the user experience: images jerk, fly out of bounds, and conflicts between pinch and swipe lead to frustration. We implement this mechanic with a guarantee of smooth 60 FPS, bounce-back, and full edge-case coverage. Our experience includes projects for iOS, Android, Flutter, and React Native — from simple galleries to high-resolution medical viewers. Using ready-made solutions reduces development time by 40% compared to building from scratch. Average budget savings amount to 20,000–40,000 rubles.
Comparison of Zoom-Panning Approaches Across Platforms
| Platform |
Library/API |
Gesture Recognizers |
Pan Limit |
Bounce-back |
| iOS (UIKit) |
UIPinchGestureRecognizer + UIPanGestureRecognizer |
Requires require(toFail:) |
CGAffineTransform + clamping |
Built-in in UIScrollView |
| iOS (SwiftUI) |
MagnificationGesture + DragGesture (with .simultaneous) |
Built-in support |
CGFloat clamping via onChanged |
withAnimation(.interactiveSpring) |
| Android (Kotlin) |
ScaleGestureDetector + GestureDetector (View) or Modifier (Compose) |
setOnTouchListener or pointerInput |
ScaleGestureDetector.SimpleOnScaleGestureListener + clamp |
ViewPropertyAnimator with setInterpolator |
| React Native |
react-native-gesture-handler + react-native-reanimated |
Gesture.Pinch() + Gesture.Pan() with Gesture.Simultaneous |
clamp() on shared values |
withSpring() |
| Flutter |
InteractiveViewer |
Built-in gesture recognition |
boundaryMargin and maxScale |
BouncingScrollPhysics |
InteractiveViewer in Flutter implements zoom 2x faster than a custom implementation using GestureDetector.
Technical Implementation Details
React Native — react-native-gesture-handler + react-native-reanimated. The standard <Image> does not support transformations via gestures — you need Animated.Image or Reanimated. Approach with useSharedValue for scale and translate X/Y, useGestureHandler for PinchGesture + PanGesture:
const scale = useSharedValue(1);
const translateX = useSharedValue(0);
const translateY = useSharedValue(0);
const pinchGesture = Gesture.Pinch()
.onUpdate((e) => {
scale.value = clamp(savedScale.value * e.scale, 1, 5);
})
.onEnd(() => {
savedScale.value = scale.value;
if (scale.value < 1) {
scale.value = withSpring(1);
}
});
Gesture.Simultaneous(pinchGesture, panGesture) — allows pinch and pan to work simultaneously. Gesture.Race() — if you need to separate them by priority.
Pan restriction to image boundaries. At zoom x3, an image of 375px becomes 1125px. Maximum allowed translateX = (scaledWidth - containerWidth) / 2. Without this check, the user can drag the image off screen. Bounds checking is implemented in onUpdate via clamp():
const maxTranslateX = (containerWidth * (scale.value - 1)) / 2;
translateX.value = clamp(translateX.value + delta, -maxTranslateX, maxTranslateX);
Flutter — InteractiveViewer. Built-in widget with minScale, maxScale, boundaryMargin. For basic cases, it's sufficient. For a gallery with multiple images — InteractiveViewer inside PageView, but a conflict arises: horizontal swipe to change photos vs horizontal pan when zoomed. Solution: InteractiveViewer intercepts pan only when scale > 1, at scale == 1 the gesture is passed to PageView.
iOS native — UIPinchGestureRecognizer + UIPanGestureRecognizer. gestureRecognizer.require(toFail:) for proper conflict resolution. CGAffineTransform for applying transformations to UIImageView. UIScrollView + UIScrollViewDelegate.viewForZooming — an alternative that gives free bounce at boundaries and zoomRect animations. In SwiftUI, a combination of MagnificationGesture and DragGesture with .simultaneous() is used. Apple's UIPinchGestureRecognizer documentation recommends require(toFail:) for conflict resolution.
How to Avoid Gesture Conflicts in Panning?
In galleries, the key issue is simultaneous swipe for flipping and pan for moving within the zoomed image. Our solution: Gesture.Simultaneous allows both gestures, but only when scale > 1. At scale == 1, pan is blocked, and the gesture is passed to FlatList or PageView. Additionally, activeOffsetX in the Pan gesture handler is used — pan activates only on horizontal shift > 10px, preventing false triggers. This approach reduces user complaints about awkward control by 40%.
Double Tap
Double tap: if scale == 1 — zoom to 2–3x at the touch point. If already zoomed — return to scale == 1. Animation via withSpring (for a rubbery feel) or withTiming with Easing.out(Easing.cubic).
The zoom point is determined from the tap coordinates relative to the image:
const focalX = tapEvent.x - containerWidth / 2;
const focalY = tapEvent.y - containerHeight / 2;
translateX.value = withSpring(-focalX * (targetScale - 1));
From practice: a medical image viewer app, React Native. Zoom on X-ray images in high resolution (4096×4096px). On Android, loading the full-size image into the Image component caused OutOfMemoryError. Solution: react-native-fast-image with resizeMode="contain" for preview + tile-based loading of full size via react-native-zoom-toolkit with Deep Zoom format support. As a result, loading time decreased by 60%, and memory consumption dropped by 3 times.
Comparison of Zoom Libraries in React Native
| Library |
High Resolution Support |
Bounce-back |
Gesture Conflicts |
| react-native-gesture-handler + reanimated |
Requires additional handling |
Via withSpring |
Gesture.Simultaneous |
| react-native-zoom-toolkit |
Built-in tile-based loading |
Built-in |
Built-in (ignores swipe when zoomed) |
| react-native-image-zoom-viewer |
Via resizeMode |
Yes (not configurable) |
Limited support |
Step-by-Step Zoom Implementation in React Native
- Import
Gesture, GestureDetector from react-native-gesture-handler and useSharedValue, withSpring from react-native-reanimated.
- Create
shared values for scale, translateX, translateY and savedScale.
- Define
PinchGesture with onUpdate updating scale with clamping via clamp(), and onEnd saving the scale.
- Define
PanGesture with onUpdate changing translateX/Y and checking image boundaries.
- Combine gestures via
Gesture.Simultaneous(pinch, pan).
- Use
Animated.View with style={{ transform: [{ translateX }, { translateY }, { scale }] }}.
- For double tap, add
Gesture.Tap() with numberOfTaps: 2 and scale animation.
- Test on a real device, checking performance (60 FPS).
Why Bounce-Back Animation Improves UX?
Bounce-back returns the image to valid boundaries when the user releases their finger. Without it, the image can 'stick' off-screen, disorienting the user. withSpring creates natural elasticity, imitating physical resistance. In Flutter, this is achieved via BouncingScrollPhysics, in iOS via the bounces flag in UIScrollView. We guarantee bounce-back is implemented with optimal animation parameters so as not to annoy the user.
What's Included in the Work
- Pinch-to-zoom with min/max scale limits (usually 1x–5x, configurable per task)
- Pan when zoomed with boundary limits
- Double tap — zoom in/out with animation to touch point
- Bounce-back when exceeding boundaries
- Integration into gallery/carousel with correct gesture conflict resolution
- Support for high-resolution images without OutOfMemoryError (via tile-based loading or fast-image)
- Performance optimization to 60 FPS on mid-range devices
More about pan boundaries
Boundary calculation depends on the container and scaled image. For example, for a container width of 375px and an image of 1000px at scale=3, image width is 3000px, extra 2625px horizontally divided in half — maxTranslateX = 1312.5px. Similarly for vertical. If the image is smaller than the container, pan is completely blocked.
Timelines
1–3 business days — single image with zoom. With gallery and gesture conflict resolution — 2–3 days. The cost is calculated individually. On average, implementing zoom with panning takes 3 to 5 business days, fitting into a typical sprint. Contact us to discuss your project — we will find the optimal solution for your stack and budget. Order implementation of smooth zoom and panning to make your app stand out from competitors. Get a consultation on your project today.
UX/UI Design for Mobile Apps: Why a Figma Layout Doesn't Guarantee a Ready Interface
A designer sends a layout—beautiful, with gradients and custom components. The developer opens it and realizes: the button is 36pt, the tap target is 20pt. On an iPhone SE, it's physically impossible to press with a thumb. The bottom sheet covers content when the keyboard appears. Navigation is built against the native iOS model. Apple will reject the app, or users will leave within a week—depending on how lucky you get with the review.
We have been designing mobile UX/UI for over 5 years and have seen hundreds of such situations. During this time, we have designed and helped launch 30+ mobile apps—from fintech products to social networks. You don't need to guess whether the design will pass App Review or Google Play—we embed platform requirements from the first screen. We'll assess your project in one day, contact us.
Mobile UX/UI is not an adaptation of web design. It is a separate discipline with specific platform constraints: safe area, touch gestures, UIViewController lifecycle, Activity state management.
Why Can't You Ignore Human Interface Guidelines and Material Design 3?
Apple HIG and Google Material Design 3 are not aesthetic recommendations. They are documented user expectations formed by years of using system applications. Expectations confirmed by user experience research on mobile platforms (User experience design).
HIG defines: minimum tap target 44×44 pt, safe area insets for notch and Dynamic Island, standard gestures (swipe back on iOS, back gesture on Android 10+). Ignoring safe area is a common mistake. safeAreaLayoutGuide in UIKit and safeAreaPadding in SwiftUI exist precisely for this. A designer who doesn't set safe area margins in Figma guarantees a bug during development.
Material Design 3 introduced Dynamic Color—the color scheme is generated from the user's wallpaper via MaterialTheme.colorScheme in Jetpack Compose. An app that ignores dynamic colors on Android 12+ looks out of place. This is not critical for niche products but is noticeable in mass-market apps.
The most painful platform guideline inconsistencies we encounter on projects:
- Custom navigation on top of system navigation. iOS users expect swipe back from any point on the left edge of the screen. A custom
NavigationController without interactive gesture breaks this. Android users expect the system back button—a custom back button in the left corner does not fully replace it.
- Modal windows instead of navigation push. Bottom sheets are appropriate for actions, not for navigating content.
- Missing haptic feedback.
UIImpactFeedbackGenerator on iOS is not decoration but part of the interface response. Buttons, swipes, and confirmation actions without tactile feedback feel broken.
Table: Comparison of iOS and Android UX/UI Requirements
| Parameter |
iOS (HIG) |
Android (Material Design 3) |
| Minimum tap target |
44×44 pt |
48×48 dp |
| Safe area |
safeAreaLayoutGuide / safeAreaPadding |
Insets in WindowInsets |
| Back gesture |
Swipe from left edge |
System back gesture (Android 10+) |
| Color scheme |
System dark/light |
Dynamic Color from wallpaper |
| Typography |
San Francisco (Dynamic Type) |
Roboto (Material Type Scale) |
| Haptic feedback |
UIImpactFeedbackGenerator |
HapticFeedbackConstants (Compose) |
How to Get the Most Out of Figma?
The Figma Variables API has changed the workflow. Design tokens—colors, typography, radii, spacing—are stored as variables and exported directly to code via figma-tokens or style-dictionary. This eliminates manual value transfer and desynchronization between design and implementation. Practice shows: Figma Variables speeds up asset handoff to development by 2–3 times compared to static frames, and using design tokens reduces code transfer errors by 60%.
Auto Layout with wrap and spacing between elements allows building components that behave like flex containers. A developer opens a component and sees not a static artifact but a description of behavior at different content sizes.
Component Properties—variants, boolean toggles, instance swaps—enable building a full design system right in Figma. A button with 4 states (default, hover, pressed, disabled), 3 sizes, and 2 icon variants is one component, not 24 frames.
Figma Prototype with Variables allows creating an interactive prototype with real state: showing how the screen changes with different variable values. This is no longer just a "clickable layout" but a full UX testing tool.
How to Benefit from Prototyping and UX Testing Before Development?
The most expensive mistake in a mobile product is to develop a feature, release it, and discover that users don't understand how it works. A Figma prototype at the testing stage costs zero development hours. Redoing a finished screen costs days. Testing a prototype before development begins reduces the number of fixes by 80%.
For usability testing, we use Maze (task testing on a prototype—the user goes through a scenario, we get heatmaps and mis-click rates) or direct sessions via UserTesting. Key metrics are task completion rate and time on task, not "like/dislike."
A/B testing on mobile is harder than on web: the App Store doesn't allow UI changes without an app update. Therefore, it's important to test hypotheses on a prototype before release, not through production experiments. According to research, fixing a bug found on a prototype costs 10 times less than after production release. And average task completion time increases by 40% after proper UX optimization during prototyping.
Why Are Animations Critical for Interface Perception?
Animations in mobile apps are feedback. An element doesn't appear instantly—it transitions to the desired state over 200–350 ms. This gives the brain context to understand what happened.
- iOS:
withAnimation in SwiftUI, UIViewPropertyAnimator in UIKit for interactive animations with interruption capabilities. Spring animations with dampingRatio are the basis of most Apple system transitions.
- Android:
AnimatedVisibility, animateContentSize, Crossfade in Compose. MotionLayout for complex scenes with multiple transformations.
- Flutter:
AnimationController + Tween, Hero animations between screens, Lottie for After Effects exports. Lottie is especially effective for onboarding illustrations and empty states.
The key constraint is 16 ms per frame (60 fps) or 8 ms (120 fps on ProMotion devices). Animations must run on the GPU via CALayer/RenderThread, not on the CPU via layoutSubviews. Profiling via Core Animation instrument in Xcode is a mandatory step before releasing animated screens.
Why Is Accessibility Not an Optional Feature?
VoiceOver on iOS and TalkBack on Android are used by up to 15% of users—this statistic is confirmed by accessibility research described in Accessibility (Wikipedia). In absolute numbers for a large app, this is thousands of people. Additionally, App Store rejections due to accessibility occur, though rarely.
Minimum checklist:
- All interactive elements have
accessibilityLabel
- Text contrast ratio at least 4.5:1 (WCAG AA)
- Dynamic Type is supported—the interface doesn't break at maximum font size
- VoiceOver focus flows through the screen in a logical order
SwiftUI automatically generates an accessibility tree from component semantics. UIKit requires manual setup of accessibilityTraits, accessibilityHint, and grouping via shouldGroupAccessibilityChildren.
What Does the Work Include?
The UX/UI design deliverables include:
| Deliverable |
Description |
| User flows and wireframes |
Screen structure and user paths |
| Design system |
Design tokens, components, Style Dictionary for export |
| UI layouts (Figma) |
All screens following platform guidelines |
| Interactive prototype |
Prototype with variables and animations |
| Development specification |
Zeplin / Figma Dev Mode with dimensions, margins, states |
| Maintenance guide |
Recommendations for adding new screens and components |
What Is the Process and Timeline?
Design goes through stages: research and competitive analysis → user flows and wireframes → design system → UI layouts → prototype → testing → handoff to development.
Timeline estimates:
| Scope |
Timeline |
| Redesign of 3–5 screens |
1–2 weeks |
| MVP (10–15 screens) |
3–5 weeks |
| Full product (30+ screens) |
6–10 weeks |
The project scope and timeline are determined after analyzing your requirements—number of screens, component complexity, whether a design system is needed or we work with an existing one. Get a consultation for your project—contact us for a preliminary assessment. Order a complete mobile app design—we'll assess your project in one day and propose the optimal work scope.