hoanglam10499 / react-native-drop-shadow

https://www.npmjs.com/package/react-native-drop-shadow
MIT License
218 stars 9 forks source link

Support new RN Architecture (Fabric / Turbo Modules) #35

Open remacr opened 4 months ago

remacr commented 4 months ago

The module does not work when using the new React Native Architecture.

"react": "18.2.0",
"react-native": "0.73.6",
"react-native-drop-shadow": "1.0.0"

Without declaring the component name in the Interop layer the component shows a red frame, to workaround this issue I specified the component name in the react-native.config.js to use the Interop layer. After doing this step, the component renders but there is no shadow effect anymore just a gray (depends on the shadow color is just an example) frame where the shadow effect was rendered before.

module.exports = {
    // Interop layer for both Android and iOS to use non-migrated libraries on New Architecture apps.
    project: {
        android: {
            unstable_reactLegacyComponentNames: [
                // list of components that needs to be wrapped by the interop layer
                'DropShadow',
            ],
        },
        ios: {
            unstable_reactLegacyComponentNames: [
                // list of components that needs to be wrapped by the interop layer
            ],
        },
    },
};

Props used

shadowColor: '#000',
shadowOffset: {
  width: 0,
  height: 0,
},
shadowOpacity: 0.1,
shadowRadius: 88,

Issue when new arch enabled

Screenshot 2024-04-15 at 2 56 10 PM