React Native Shadow Generator

Generate React Native shadow styles that look the same on iOS and Android. Set an Android elevation and the matching iOS shadowOffset, shadowRadius and shadowOpacity are filled in for you, then fine-tune them and pick a shadow color. Copy a StyleSheet snippet, the boxShadow string for React Native 0.76+, or the web CSS equivalent. It's free, runs in your browser, and nothing is uploaded.

Elevation to iOS (approximate)

ElevationheightshadowRadiusshadowOpacity
100.540.18
211.080.18
422.160.19
844.320.19
1266.480.20
241212.960.22

When to use it

  1. Make cards cast matching shadows on iOS and Android.
  2. Convert a design's elevation level into iOS shadow props.
  3. Move to the unified boxShadow style on the New Architecture.
  4. Share the same shadow with a React Native Web build.

How to Use

  1. Set the Android elevation.
  2. Fine-tune the iOS offset, radius and opacity if needed.
  3. Pick the shadow color.
  4. Copy the StyleSheet, boxShadow or web CSS.

Features

  1. Elevation to iOS shadow mapping
  2. Independent iOS fine-tuning
  3. StyleSheet snippet
  4. boxShadow for RN 0.76+
  5. Web CSS equivalent
  6. 100% client-side

FAQs

Why don't my shadows show on Android?

Classic Android shadows only come from elevation, and the view needs a background color. shadowColor and shadowOffset are ignored there.

How do I match iOS shadows to Android elevation?

Set the elevation here; the iOS values are calculated from it with the common approximation, then you can adjust them.

What is boxShadow in React Native?

From React Native 0.76 with the New Architecture, a CSS-style boxShadow works on both platforms. Older versions need the platform-specific props.

Why does the iOS shadow get clipped?

overflow: 'hidden' on the same view clips the shadow. Put the shadow on a wrapper view.

Is anything uploaded?

No. The styles are generated in your browser.

Technical Details

React Native has historically drawn shadows differently on each platform. iOS uses four props — shadowColor, shadowOffset, shadowOpacity and shadowRadius — while Android uses a single elevation number that the system turns into a Material shadow, ignoring color, offset and opacity. To keep the two looking alike, the generator starts from the Android elevation and derives iOS values with the approximation widely used in the React Native community: a vertical offset of about half the elevation, a radius of about 0.54 times it, and opacity rising slowly from 0.18. The iOS values can then be fine-tuned independently. React Native 0.76 and later, on the New Architecture, also accept a CSS-style boxShadow string that renders the same on both platforms, so that form is generated too, along with the plain web CSS for React Native Web or a design handoff. The preview approximates the iOS shadow with CSS.

Web & CSS Tools

Web & CSS Tools

  • CSS Specificity Calculator
  • CSS Color & Property Extractor
  • Responsive Breakpoint Cheatsheet
  • Google Fonts Pair Finder
  • CSS Clamp Generator
  • Fluid Type Scale Generator
  • CSS Flexbox Generator
  • CSS Grid Generator