Product showcase
Product shots cut out to their outline, tall and wide in turn: the liquid pours one outline into the next.
How it works
Section titled “How it works”- PNGs on a transparent background are what the liquid effect is made for: the blob takes the outline of one product and reforms as the next.
mediaHeightandmediaPaddinggive the products room;mediaFitiscontainby default.getPlaceholderColorfills the image area with the product’s color, pulsing gently, while a remote image loads; the image fades in over it.renderFootergets the current item: the button takes its color.
Uses
Full source
Section titled “Full source”This is the code running in the phone. Copy it, swap the data, and it is yours.
import { MorphCarousel } from 'expo-morph-carousel';import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
import { showcase } from '../data/products';import { column } from '../data/layout';
/** * The layout from the SwiftUI "morphing carousel": a card with the product * image on top, the title and description sliding underneath, dots and a * button at the bottom. The image melts into the next one while the text * slides. */export default function ProductScreen() { return ( // "automatic": on iOS the native header is translucent and the screen // starts under it; the scroll view insets its content below the header. <ScrollView contentInsetAdjustmentBehavior="automatic" contentContainerStyle={[styles.screen, column]}> <Text style={styles.section}>Demo</Text> <MorphCarousel testID="product-carousel" data={showcase} keyExtractor={(p) => p.id} getImage={(p) => p.image} getPlaceholderColor={(p) => p.color} getAccessibilityLabel={(p) => p.title} accessibilityLabel="Products" mediaHeight={300} // Tapping works too: the left third goes back, the rest forward. tapToNavigate mediaPadding={28} style={styles.card} renderItem={({ item }) => ( <View style={styles.page}> <Text style={styles.title}>{item.title}</Text> <Text style={styles.description}>{item.description}</Text> </View> )} renderFooter={({ item }) => ( <Pressable style={[styles.button, { backgroundColor: item?.color ?? '#1c1c1e' }]}> <Text style={styles.buttonText}>Continue</Text> </Pressable> )} /> </ScrollView> );}
const styles = StyleSheet.create({ screen: { padding: 16 }, section: { fontSize: 13, color: '#6e6e73', marginBottom: 8, marginLeft: 4 }, card: { height: 560, borderRadius: 28, backgroundColor: '#fff' }, page: { flex: 1, alignItems: 'center', paddingHorizontal: 28, paddingTop: 12, gap: 10 }, title: { fontSize: 24, fontWeight: '700', color: '#1c1c1e' }, description: { fontSize: 15, lineHeight: 21, color: '#6e6e73', textAlign: 'center' }, button: { alignSelf: 'stretch', marginHorizontal: 24, paddingVertical: 14, borderRadius: 14, alignItems: 'center', }, buttonText: { color: '#fff', fontSize: 16, fontWeight: '600' },});import type { ImageSourcePropType } from 'react-native';
export type Product = { id: string; title: string; description: string; image: ImageSourcePropType; /** Shown as a blob while the image loads, and used for accents. */ color: string;};
export const products: Product[] = [ { id: 'orb', title: 'Meet Orb', description: 'A glossy sphere with a soft highlight. Swipe to watch it melt into the next shape.', image: require('../assets/shapes/orb.png'), color: '#6a4fd8', }, { id: 'tile', title: 'Explore Tile', description: 'A rounded square with a warm gradient, the kind of shape app icons are made of.', image: require('../assets/shapes/tile.png'), color: '#f0a020', }, { id: 'ring', title: 'Discover Ring', description: 'A torus with a hole in the middle. The liquid effect fills it in, then opens it again.', image: require('../assets/shapes/ring.png'), color: '#20a890', }, { id: 'pill', title: 'Experience Pill', description: 'A tall capsule. Tall and wide shapes stretch the blob in between.', image: require('../assets/shapes/pill.png'), color: '#3478f6', }, { id: 'heart', title: 'Love Heart', description: 'Two circles and a point. Watch the point grow out of the blob.', image: require('../assets/shapes/heart.png'), color: '#eb405a', },];
/** * Devices for the product showcase: original drawings (example/scripts/ * make-devices.mjs), cropped to their outline. Dark bodies and glowing * screens of different colors make the liquid morph easy to follow. */export const devices: Product[] = [ { id: 'watch', title: 'Meet Orbit Watch', description: 'A rounded case on a woven band. Swipe and it melts into the next device.', image: require('../assets/devices/watch.png'), color: '#6a4fd8', }, { id: 'phone', title: 'Nova Phone', description: 'Edge-to-edge glass with an ocean wallpaper, tall and narrow.', image: require('../assets/devices/phone.png'), color: '#0b7fc4', }, { id: 'laptop', title: 'Explore Slate Laptop', description: 'A wide screen on a thin base: the blob stretches from tall to wide.', image: require('../assets/devices/laptop.png'), color: '#c2368f', }, { id: 'mini', title: 'Cube Mini', description: 'A small silver box with no screen at all, seen from above.', image: require('../assets/devices/mini.png'), color: '#8f959d', }, { id: 'desktop', title: 'Vista Desktop', description: 'A large display with a sunset on a round foot.', image: require('../assets/devices/desktop.png'), color: '#e0566b', },];
/** * Product photos for the showcase, cut out of their studio background and * cropped to the product. Tall and wide products alternate, so the liquid * blob visibly stretches from one outline to the next. */export const showcase: Product[] = [ { id: 'watch-plum', title: 'Watch Series 12', description: 'A plum sport band and an always-on display. Swipe and it melts into the next product.', image: require('../assets/showcase/watch-plum.png'), color: '#5c1f33', }, { id: 'macbook', title: 'MacBook Pro 14', description: 'From a tall watch to a wide laptop: the blob stretches sideways on the way.', image: require('../assets/showcase/macbook.png'), color: '#2c2c30', }, { id: 'iphone-red', title: 'iPhone 18 Pro', description: 'Tall and narrow again, in a deep red finish with a three-camera plateau.', image: require('../assets/showcase/iphone-red.png'), color: '#6e2334', }, { id: 'mini-front', title: 'Mac mini', description: 'The widest of all: a low silver box, seen from the front.', image: require('../assets/showcase/mini-front.png'), color: '#6b7076', }, { id: 'iphone-white', title: 'iPhone 18 Pro, white', description: 'The back and the side: two outlines the liquid has to join.', image: require('../assets/showcase/iphone-white.png'), color: '#7d7a76', }, { id: 'iphone-duo', title: 'iPhone Duo', description: 'A phone that unfolds into a small laptop, half open.', image: require('../assets/showcase/iphone-duo.png'), color: '#1f2b45', }, { id: 'watch-starlight', title: 'Watch Series 12, starlight', description: 'A light band and a vivid purple face, back to a tall outline.', image: require('../assets/showcase/watch-starlight.png'), color: '#6a3fc8', }, { id: 'mini-top', title: 'Mac mini, from above', description: 'A rounded square to finish: the blob settles into an even shape.', image: require('../assets/showcase/mini-top.png'), color: '#5e6369', },];
/** Media height of the remote screen's carousel; the home screen prefetches for it. */export const REMOTE_MEDIA_HEIGHT = 240;/** Horizontal padding of the remote screen around the carousel. */export const REMOTE_SIDE_MARGIN = 16;
/** Photos are requested at 4:3; the carousel covers its area and crops the rest. */export const heightFor = (width: number) => Math.round((width * 3) / 4);
/** * An Unsplash image URL at a given size. Unsplash serves through imgix, which * resizes on the fly: `w` and `h` in pixels, `fit=crop` fills the box. */export function unsplashUrl(id: string, width: number, height: number) { return `https://images.unsplash.com/photo-${id}?w=${width}&h=${height}&fit=crop&q=80&fm=jpg`;}
/** * Remote photos for the image-loading demo, from Unsplash (free to use under * the Unsplash License, https://unsplash.com/license). `uri` is a fixed 800 px * variant; the remote screen builds the URL per size with `unsplashUrl`. * * Unsplash answers with `Cache-Control: max-age=31536000` (one year), so with * `respectHttpHeaders` on, the cache keeps these for a year. */export const photos = [ { id: '1506905925346-21bda4d32df4', title: 'Sea of clouds', color: '#5b6478' }, { id: '1501785888041-af3ef285b470', title: 'Alpine lake', color: '#2fa7a0' }, { id: '1470071459604-3b5ec3a7fe05', title: 'Misty valley', color: '#6e7a5a' }, { id: '1441974231531-c6227db76b6e', title: 'Forest path', color: '#3e4a2c' }, { id: '1507525428034-b723cf961d3e', title: 'Beach at sunset', color: '#7fc4c8' }, { id: '1500530855697-b586d89ba3ee', title: 'Desert road', color: '#a0553c' }, { id: '1433086966358-54859d0ed716', title: 'Waterfall', color: '#3f6b3a' },].map((p) => ({ ...p, uri: unsplashUrl(p.id, 800, 600),}));View on GitHub: app/product.tsxView on GitHub: data/products.ts