expo / react-native-action-sheet

A cross-platform ActionSheet for React Native
MIT License
1.4k stars 226 forks source link

[web] expo sdk >47 setNativeProps fix #312

Closed LinoIten closed 1 year ago

LinoIten commented 1 year ago

i ran into a problem with expo sdk 49 and exporting to web and just wanted to share the fix for the depricated setNativeProps implementation. this is my patch from patch-package:

diff --git a/node_modules/react-native-actions-sheet/dist/src/index.js b/node_modules/react-native-actions-sheet/dist/src/index.js
index 064a25f..d403411 100644
--- a/node_modules/react-native-actions-sheet/dist/src/index.js
+++ b/node_modules/react-native-actions-sheet/dist/src/index.js
@@ -843,11 +843,11 @@ export default forwardRef(function ActionSheet(_a, ref) {
             windowDimensions.width < windowDimensions.height;
         if (orientationChanged)
             isOrientationChanging.current = true;
-        (_a = deviceContainerRef.current) === null || _a === void 0 ? void 0 : _a.setNativeProps({
-            style: {
-                height: Dimensions.get('screen').height - safeMarginFromTop
-            }
+        
+        (_a = deviceContainerRef.current) === null || _a === void 0 ? void 0 : setDimensions({
+            height: Dimensions.get('screen').height - safeMarginFromTop
         });
+        
         setDimensions(function (dim) {
             return __assign(__assign({}, dim), { height: height, portrait: windowDimensions.width < windowDimensions.height });
         });
bradbyte commented 1 year ago

Thanks @LinoIten!

bradbyte commented 1 year ago

@LinoIten any chance are you using react-native-actions-sheet (note the plurality) and not @expo/react-native-action-sheet. I don't see that line actually in our codebase.

LinoIten commented 1 year ago

haha yes you're correct. i kinda messed up, sorry.