WadhahEssam / react-native-theme-switch-animation

A Plug & Play Animations for Switching (Dark/Light) Themes. 🌖
MIT License
344 stars 24 forks source link

Error: The package 'react-native-theme-switch-animation' doesn't seem to be linked #7

Closed ThalesBMC closed 11 months ago

ThalesBMC commented 11 months ago

Anyone having this problem when trying to add the package to a project?

node: v16. React Native: 0.63.4 (I think this is probably the problem)

Error: The package 'react-native-theme-switch-animation' doesn't seem to be linked. Make sure:

ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

WadhahEssam commented 11 months ago

that is very old version, it could be the problem, but are you sure you did the pod install step?

ThalesBMC commented 11 months ago

that is very old version, it could be the problem, but are you sure you did the pod install step?

Yep, It's probably the old version.

When I update to a new version I will test again.

ThalesBMC commented 11 months ago

@WadhahEssam,

I've identified a solution for manual linking of the react-native-theme-switch-animation library in older versions, which is necessary due to the use of the turbo package. Here are the steps for both iOS and Android platforms:

iOS:

  1. Update your Podfile with the following line:
    
    pod 'react-native-theme-switch-animation', :path => '../node_modules/react-native-theme-switch-animation'

Android:

Modify your android/app/build.gradle file to include:

implementation project(':react-native-theme-switch-animation')

Update your settings.gradle file with:

include ':react-native-theme-switch-animation'
project(':react-native-theme-switch-animation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-theme-switch-animation/android')

MainApplication.java, import and add ThemeSwitchAnimationPackage to the packages list:

import com.themeswitchanimation.ThemeSwitchAnimationPackage;
packages.add(new ThemeSwitchAnimationPackage());
WadhahEssam commented 11 months ago

@ThalesBMC that is wild, I remember there was something like yarn link [library-name] it was used to link native android libs, is that still an option,

Thanks Thales 👌