dev.cds-mobile

USE THIS when asked to work on a new or existing (MOBILE) CDS React component in packages/mobile

npx skills add https://github.com/coinbase/cds --skill dev.cds-mobile

CDS Mobile Package Guidelines

Mobile-specific patterns for @coinbase/cds-mobile.

Component Config Adoption (Mobile)

Use this guidance when adding ComponentConfigProvider defaults for the specific component you are editing.

Required implementation pattern

  1. Register the component in packages/mobile/src/core/componentConfig.ts using its *BaseProps:
import type { MyComponentBaseProps } from '../category/MyComponent';

export type ComponentConfig = {
  MyComponent?: ConfigResolver<MyComponentBaseProps>;
};
  1. Adopt useComponentConfig in the component and destructure from merged props:
import { useComponentConfig } from '../hooks/useComponentConfig';

export const MyComponent = memo((_props: MyComponentProps) => {
  const mergedProps = useComponentConfig('MyComponent', _props);
  const { style, ...props } = mergedProps;

  return <Pressable style={style} {...props} />;
});

Rules to preserve behavior

  • Provider config supplies defaults only; local props must continue to win.
  • Use _props as the input variable and mergedProps as the configured output.
  • Type resolver entries with *BaseProps (not full *Props).
  • Keep scope to prop-level theming defaults; do not alter component behavior or control flow.
  • When practical during the same change, prefer arrow-function component declarations.

Styling with StyleSheet

Use StyleSheet.create for static styles and useTheme() for dynamic values:

import { StyleSheet, type StyleProp, type ViewStyle } from 'react-native';

const styles = StyleSheet.create({
  container: { position: 'relative', width: '100%' },
});

// Dynamic styles via theme hook
const theme = useTheme();
const dynamicStyle = {
  backgroundColor: theme.color.bgPrimary,
  padding: theme.space[2],
};

<View style={[styles.container, dynamicStyle, style]} />;

Inline styles

  • Mobile components should all expose a style and styles object props for overriding default styles.
  • As styling is a concern of that specific component, the style and styles props should never be on the *BaseProps type.
  • styles can be used for granular overrides on child elements within the component.
  • Always merge styles into a react-native style array with useMemo in the correct order (default styles => style prop => styles[ELEMENT_NAME] prop).

Example:

type ComponentProps = ComponentBaseProps & {
  style?: StyleProp<ViewStyle>;
  styles?: {
    root?: StyleProp<ViewStyle>;
    label?: StyleProp<TextStyle>;
  };
};

const theme = useTheme();
const containerStyles = useMemo(
  () => [
    { backgroundColor: theme.color.bgPrimary }, // default styles
    style, // from props
    styles.root, // from props
  ],
  [theme.color.bgPrimary, animatedStyles, style]
);

// Apply to component
<Box style={containerStyles}>

Animation

React Native Reanimated

import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';

const opacity = useSharedValue(0);
const animatedStyle = useAnimatedStyle(() => ({
  opacity: opacity.value,
  transform: [{ translateY: withTiming(opacity.value * -8) }],
}));

<Animated.View style={animatedStyle} />;

We DO NOT use React-Spring anymore for animations on mobile.

Gesture Handling

Use react-native-gesture-handler:

import { Gesture, GestureDetector } from 'react-native-gesture-handler';

const panGesture = useMemo(
  () =>
    Gesture.Pan()
      .onStart(() => {
        /* ... */
      })
      .onUpdate(({ translationX }) => {
        /* ... */
      })
      .onEnd(({ translationX, velocityX }) => {
        /* ... */
      })
      .withTestId(testID)
      .runOnJS(true),
  [dependencies],
);

<GestureDetector gesture={panGesture}>
  <Animated.View>{/* ... */}</Animated.View>
</GestureDetector>;

Layout Measurement

Use onLayout callback instead of ResizeObserver:

const [size, onLayout] = useLayout();
<View onLayout={onLayout} />

// Or inline
<View onLayout={(e) => setHeight(e.nativeEvent.layout.height)} />

Accessibility

  • Use appropriate accessibilityLabel, accessibilityHint, and accessibilityRole, accessibilityState props
  • Support screen readers (VoiceOver and TalkBack)
  • Ensure touch targets meet minimum size requirements (44x44 points)

Example: Use React Native accessibility props:

<View
  accessible
  accessibilityRole="adjustable"
  accessibilityLabel="Product carousel"
  accessibilityLiveRegion="polite"
>
  <Pressable
    accessibilityState={{ selected: isActive, disabled }}
    accessibilityActions={[{ name: 'activate' }]}
    onAccessibilityAction={handleAccessibilityAction}
  />
</View>

Screen Reader Content

// Hide visual content from screen readers
<View accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
  {/* Animated/visual content */}
</View>

// Provide accessible alternative
<Text
  importantForAccessibility="yes"
  accessibilityLiveRegion="polite"
  style={{ color: 'transparent', position: 'absolute' }}
>
  {accessibleLabel}
</Text>

Reference Components

  • SlideButton: gesture handling, spring animations, accessibility actions
  • RollingNumber: Reanimated, measurement patterns, screen reader content
  • Select (alpha/): controlled/uncontrolled, Drawer integration
  • Stepper: direction-based defaults, shared logic from cds-common
  • Tour: animations, complexity
  • DatePicker: complexity

More skills from coinbase

git.repo-manager
coinbase
git.repo-manager — an installable skill for AI agents, published by coinbase/cds.
official
agentic-wallet
coinbase
Crypto wallet operations via the awal CLI — sign in, check balances, send USDC/ETH/POL/SOL, trade tokens, fund the wallet, and use the x402 payment protocol to…
official
authenticate-wallet
coinbase
Email OTP-based wallet authentication with validation and status checking. Two-step login flow: initiate with email to receive a 6-digit OTP, then verify with the flowId and code to complete authentication Includes input validation rules for email, flowId, and OTP to prevent shell injection before executing commands Provides status checking, balance queries, address retrieval, and wallet window access via companion CLI commands All commands support --json output for machine-readable...
official
fund
coinbase
Deposit USDC to wallet via Coinbase Onramp or direct transfer. Opens a companion UI where users select preset amounts ($10, $20, $50) or custom values and choose from Apple Pay, debit card, bank transfer, or Coinbase account funding Supports multiple payment methods with varying settlement times: instant for card and Apple Pay, 1–3 days for ACH bank transfers Deposits funds as USDC on the Base network; alternatively, users can send USDC directly to the wallet address via npx awal@2.0.3...
official
monetize-service
coinbase
Deploy a paid API endpoint that other agents can discover and pay for via x402 protocol. Charges USDC per request on Base using HTTP 402 payment protocol; clients pay with signed transactions, no API keys or accounts required Automatically registers endpoints with the x402 Bazaar for agent discovery when you declare discovery extensions Supports multiple pricing tiers, wildcard routes, and multiple payment options per endpoint using Express middleware Built on @x402/express and @x402/core...
official
pay-for-service
coinbase
Call paid APIs on Base with automatic USDC payment via x402 protocol. Executes HTTP requests (GET, POST, etc.) to x402-enabled endpoints with atomic USDC payments handled automatically Supports request customization through method, JSON body, query parameters, and custom headers Includes payment controls: set maximum USDC amount per request and group related operations with correlation IDs Requires wallet authentication and sufficient USDC balance; validates all user input to prevent shell...
official
query-blockchain-data
coinbase
Query onchain blockchain data on Base using the CDP SQL API via x402. Use when you or your user want to view onchain information about decoded blocks,…
official
query-onchain-data
coinbase
Query onchain data on Base using SQL with per-query x402 payments. Access decoded events, transactions, and blocks via CoinbaseQL, a ClickHouse-based SQL dialect supporting joins, CTEs, subqueries, and standard functions Three main tables available: base.events (decoded smart contract logs), base.transactions (full transaction data), and base.blocks (block metadata) Requires filtering on indexed fields ( event_signature , address , block_timestamp ) in event queries to avoid full table...
official