th3rdwave / react-native-safe-area-context

A flexible way to handle safe area insets in JS. Also works on Android and Web!
MIT License
2.14k stars 197 forks source link

Getting warning StyleSheet.compose(a, b) is deprecated; use array syntax, i.e., [a,b] for expo-web in nx-workspace without webpack. #457

Closed pratish-respo closed 10 months ago

pratish-respo commented 10 months ago

Current behavior

I am using react-native-safe-area-context package in my nx-workspace. In my workspace, I have mobile(react-native) & web(expo-web). When i run my web project with react-native-web version 0.19.6, I am getting a warning StyleSheet.compose(a, b) is deprecated; use array syntax, i.e., [a,b]. Screenshot from 2023-11-30 15-12-30

Expected behavior

Instead of using StyleSheet.compose in styles as below

style: StyleSheet.compose(styles.fill, style)

we have to use array syntax as below

style: [styles.fill, style]

This above change removes the warning in web.

Platform

Environment

package version
react-native-safe-area-context 4.7.4
react-native 0.72.4
react-native-web 0.19.6
expo 49.0.20
node 16.20.0
npm 9.6.7
jacobp100 commented 10 months ago

As far as I can tell, it's not deprecated by react-native, it looks like react-native-web is deprecating an API they don't own. Maybe you could file an issue with them