Common Issue: When using Expo Router with React Native Web, you encounter warnings about
shadow*properties andpointerEventsprops that aren't compatible with web environments.
This issue affects most Expo Router templates and React Navigation setups when targeting web platforms. The warnings occur because:
- Shadow Properties: React Native's
shadowColor,shadowOffset,shadowOpacity,shadowRadiusdon't work on web - needboxShadow*equivalents - pointerEvents Props: Web compatibility requires
pointerEventsto be instyleobjects, not as direct props
| Package | Version | Files Affected |
|---|---|---|
expo-router |
~5.1.4 |
build/views/Sitemap.js |
@react-navigation/elements |
^2.6.1 |
lib/module/Screen.js, lib/module/Header/Header.js |
react-native-screens |
~4.11.1 |
lib/commonjs/components/ScreenStackHeaderConfig.js |
We'll use Bun's native patch system to fix these issues:
- Replace
shadow*properties withboxShadow*equivalents - Move
pointerEventsprops tostyleobjects - Apply patches automatically on install
# No additional dependencies needed - Bun has native patching supportbun patch expo-routerEdit: node_modules/expo-router/build/views/Sitemap.js
Find (around line 139):
shadowColor: '#000',
shadowOffset: {
width: 0,
height: 3,
},
shadowOpacity: 0.33,
shadowRadius: 3,Replace with:
boxShadowColor: '#000',
boxShadowOffset: {
width: 0,
height: 3,
},
boxShadowOpacity: 0.33,
boxShadowRadius: 3,Commit:
bun patch --commit node_modules/expo-routerbun patch @react-navigation/elementsEdit: node_modules/@react-navigation/elements/lib/module/Screen.js
Find:
children: /*#__PURE__*/_jsx(View, {
pointerEvents: "box-none",
onLayout: e => {
// ...
},
style: [styles.header, headerTransparent ? styles.absolute : null],Replace with:
children: /*#__PURE__*/_jsx(View, {
onLayout: e => {
// ...
},
style: [{ pointerEvents: "box-none" }, styles.header, headerTransparent ? styles.absolute : null],Edit: node_modules/@react-navigation/elements/lib/module/Header/Header.js
Apply similar fixes to 7 instances of pointerEvents props, moving them all to style objects.
Commit:
bun patch --commit node_modules/@react-navigation/elementsbun patch react-native-screensEdit: node_modules/react-native-screens/lib/commonjs/components/ScreenStackHeaderConfig.js
Find:
style: styles.headerConfig,
pointerEvents: "box-none"Replace with:
style: [{ pointerEvents: "box-none" }, styles.headerConfig]Commit:
bun patch --commit node_modules/react-native-screensYour package.json should now include:
{
"patchedDependencies": {
"[email protected]": "patches/[email protected]",
"@react-navigation/[email protected]": "patches/@react-navigation%[email protected]",
"[email protected]": "patches/[email protected]"
}
}rm -rf node_modules && bun installThe following patch files will be created in your patches/ directory:
diff --git a/build/views/Sitemap.js b/build/views/Sitemap.js
index a61428d..f6f2327 100644
--- a/build/views/Sitemap.js
+++ b/build/views/Sitemap.js
@@ -136,13 +136,13 @@ const styles = react_native_1.StyleSheet.create({
paddingVertical: 16,
borderBottomWidth: 1,
borderColor: '#313538',
- shadowColor: '#000',
- shadowOffset: {
+ boxShadowColor: '#000',
+ boxShadowOffset: {
width: 0,
height: 3,
},
- shadowOpacity: 0.33,
- shadowRadius: 3,
+ boxShadowOpacity: 0.33,
+ boxShadowRadius: 3,
elevation: 8,
},
headerContent: {@react-navigation%[email protected]
Contains fixes for:
Screen.js: 1 pointerEvents fixHeader/Header.js: 7 pointerEvents fixes (including conditional logic)
diff --git a/lib/commonjs/components/ScreenStackHeaderConfig.js b/lib/commonjs/components/ScreenStackHeaderConfig.js
index abc123..def456 100644
--- a/lib/commonjs/components/ScreenStackHeaderConfig.js
+++ b/lib/commonjs/components/ScreenStackHeaderConfig.js
@@ -17,8 +17,7 @@ const ScreenStackHeaderConfig = exports.ScreenStackHeaderConfig = /*#__PURE__*/
ref: ref,
topInsetEnabled: _edgeToEdge.EDGE_TO_EDGE ? true : props.topInsetEnabled,
- style: styles.headerConfig,
- pointerEvents: "box-none"
+ style: [{ pointerEvents: "box-none" }, styles.headerConfig]
})));After applying patches, verify fixes:
# Check that no direct pointerEvents props remain (should return empty)
grep -R 'pointerEvents: "' node_modules/@react-navigation/elements node_modules/react-native-screens | grep -v 'style.*pointerEvents'
# Check that boxShadow* properties are applied
grep -A5 -B5 'boxShadowColor' node_modules/expo-router/build/views/Sitemap.js- β Eliminates warnings in web builds
- β Automatic application on every install
- β Team consistency via committed patches
- β Minimal overhead - only affects problematic files
- β Future-proof - patches persist across installs
- Bun as package manager
- Expo Router
~5.1.4 - React Navigation Elements
^2.6.1 - React Native Screens
~4.11.1
- Patches are applied automatically during
bun install - Commit the
patches/directory to version control - If package versions change, patches may need updating
- No additional dependencies required - uses Bun's native patching
This solution addresses common warnings in:
- Expo Router web builds
- React Navigation web compatibility
- Next.js + React Native Web setups
- Any template using these packages for web targets
β¨ Created by: Fixing common Expo Router/Web compatibility issues
π§ Tested with: Bun 1.2.19, Expo SDK 53, React Native 0.80+