Iphone Duo React Native logo

Iphone Duo React Native

Community
mirzaaghazadeh
iphone-duo-react-native

Adapt a React Native or Expo app to iPhone Duo, Apple's first foldable iPhone — asymmetric safe area insets, resize handling, and how to expose the iOS 27.1 reserved-region and hinge APIs through a native module. Use when a React Native, Expo or JS-based iOS app needs foldable iPhone support.

Overview

Publishermirzaaghazadeh
Repositoryiphone-duo-skills
Skill nameiphone-duo-react-native
Stars
188
Forks
9
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by mirzaaghazadeh on GitHub. Read the source before you install it.

Installation

Install the Iphone Duo React Native AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/mirzaaghazadeh/iphone-duo-skills/tree/main/skills/iphone-duo-react-native
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/mirzaaghazadeh/iphone-duo-skills.git /tmp/iphone-duo-skills
mkdir -p .claude/skills
cp -r /tmp/iphone-duo-skills/skills/iphone-duo-react-native .claude/skills/iphone-duo-react-native
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Iphone Duo React Native in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Iphone Duo React Native on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Iphone Duo React Native is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

React Native on iPhone Duo

React Native has no fold or hinge API. There is no useDisplayFeatures, no hinge event, nothing that tells JavaScript the device is folded. As of this writing no React Native or Expo release has shipped iPhone Duo support.

The good news is that the two things that break most often — resizing and safe areas — are already solvable with libraries you probably have installed. Work in two tiers.

Tier 1 — works today, no native code

Safe area insets, handled per edge

This is where React Native apps break on iPhone Duo, and it is worth being blunt about why: the safe area is asymmetric here. iOS moves its controls to one side of the display, so left and right insets differ — and which side depends on the pose and on which half of a Split View your app occupies.

Use useSafeAreaInsets() from react-native-safe-area-context. It returns { top, right, bottom, left } as independent numbers, and it updates when the insets change.

js
const insets = useSafeAreaInsets();
// each edge, independently
paddingLeft: insets.left,
paddingRight: insets.right,

Three things to avoid:

  • SafeAreaView from react-native core — deprecated, and it only ever handled the notch case properly. Use the context library's hook or its SafeAreaView.
  • Symmetric math — anything shaped like width - insets.left * 2 is wrong the moment the insets differ, which on this device is most of the time.
  • Reading insets once — they change while the app is running, so read them through the hook on every render rather than caching.

If you're on React Native 0.81+ with edge-to-edge enabled, your content already extends under the system UI, which makes correct inset handling load-bearing rather than cosmetic.

Resize on every render

The window changes size constantly on iPhone Duo: opening, closing, folding, rotating, entering Split View.

Use useWindowDimensions(). It is a hook, so it re-renders on change — unlike Dimensions.get('window'), which returns a snapshot that silently goes stale. If you have Dimensions.get(...) at module scope or in a constant, that is a bug on this device.

For component-level sizing, onLayout gives you the actual measured box, which is more reliable than deriving from window dimensions.

Branch on width, not on device

iOS thinks in size classes: the outer display is compact width, the inner is regular width. React Native has no equivalent, so use width breakpoints from useWindowDimensions().

Do not branch on Platform.OS, a device model from react-native-device-info, or orientation. The inner display does not honor supported orientations, so orientation tells you less than you think.

Give the inner display a real layout

A phone layout stretched to 7.6 inches looks unfinished. The cheap win is a two-column or master-detail layout above your wide breakpoint — and if you use React Navigation, a drawer or rail-style navigator on wide and tabs on narrow.

Tier 2 — needs a native module

Anything genuinely iPhone Duo-specific requires bridging from Swift. Worth it in this order:

Native API (iOS 27.1)Why expose it to JS
reservedRegions(kind:) on UIViewKeep touch targets out of the fold and clear of the under-display camera
UIHingeInteractionContinuous hinge angle, for effects
traitCollection size classThe signal iOS actually uses, instead of your breakpoint guess

Shape of the module

Write a TurboModule (New Architecture) or a legacy native module, with a NativeEventEmitter for anything continuous. The hinge angle is a live stream — push it as events; do not let JS poll it.

Query the reserved regions from the view your React content is mounted in, since those APIs hang off UIView and regions are reported relative to a view. Emit regions as plain objects ({ x, y, width, height, kind, active }) so JS can lay out against them directly.

Guard hard. The same JS bundle runs on every iPhone, so the module must return "no regions, no hinge" on non-folding devices and on anything below iOS 27.1 rather than throwing. Availability-check in Swift; never assume.

If you are in Expo, this means a config plugin plus a local native module — it will not work in Expo Go, so you need a development build.

Then feed it into Tier 1

Once regions reach JS, they are just numbers in your existing layout. An absolute View positioned around a division region keeps a control out of the fold; a marginRight derived from an occlusion region keeps content off the camera.

What to do, in order

  1. Swap any Dimensions.get() for useWindowDimensions().
  2. Swap core SafeAreaView for useSafeAreaInsets(), and audit every inset expression for symmetric math.
  3. Replace platform/orientation branching with width breakpoints.
  4. Add a wide-layout path so the inner display earns its size.
  5. Only then write the native module, and only if fold awareness genuinely improves the app.

Steps 1–4 are plain React Native work that pays off on tablets and foldable Android too. Step 5 is the only iPhone Duo-specific part, and it needs the Xcode 27.1 simulator to test.

The reasoning behind the native APIs is in ../iphone-duo-adaptive-layout/SKILL.md and ../iphone-duo-readiness/SKILL.md. The design guidance in ../iphone-duo-design-review/SKILL.md is framework-neutral and applies to a React Native app unchanged.

Frequently asked questions

What does the Iphone Duo React Native AI skill do?

Adapt a React Native or Expo app to iPhone Duo, Apple's first foldable iPhone — asymmetric safe area insets, resize handling, and how to expose the iOS 27.1 reserved-region and hinge APIs through a native module. Use when a React Native, Expo or JS-based iOS app needs foldable iPhone support.

Why use Iphone Duo React Native on TypingMind?

Because you install it once and use it with any model. Iphone Duo React Native is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Iphone Duo React Native in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/mirzaaghazadeh/iphone-duo-skills/tree/main/skills/iphone-duo-react-native. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Iphone Duo React Native?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Iphone Duo React Native?

As many as you like. As long as a model supports skills, you can use Iphone Duo React Native with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Iphone Duo React Native AI skill free?

It is published on GitHub by mirzaaghazadeh. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇