kadiraydinli / react-native-system-navigation-bar

React Native lets you customize the navigation bar for Android.
https://www.npmjs.com/package/react-native-system-navigation-bar
MIT License
270 stars 19 forks source link

error: cannot find symbol WindowCompat.setDecorFitsSystemWindows(view, enabled); #52

Closed MSetnik closed 1 year ago

MSetnik commented 1 year ago

Description

After installing plugin build for android fails with this error:

../node_modules/react-native-system-navigation-bar/android/src/main/java/com/reactnativesystemnavigationbar/SystemNavigationBarModule.java:289: error: cannot find symbol WindowCompat.setDecorFitsSystemWindows(view, enabled);

symbol: method setDecorFitsSystemWindows(Window,Boolean) location: class WindowCompat

react-native-system-navigation-bar version

2.6.0

React Native version

0.66.0

Snack, code example, screenshot, or link to a repository

No response

kadiraydinli commented 1 year ago

Hi @MSetnik, can you run the following command in the project's home directory and test again?

cd android && ./gradlew clean && cd ..
MSetnik commented 1 year ago

Still doesnt work. Im on RN version 0.66.0 so that could be the issue

kadiraydinli commented 1 year ago

@MSetnik Do you get this error when you try to use the "setFitsSystemWindows" function of the this package? Can you share the versions of buildToolsVersion, minSdkVersion, compileSdkVersion and targetSdkVersion in your android/build.gradle file? As you said, react native version is very old and probably doesn't support setDecorFitsSystemWindows. I can quickly release a new version. By the way, I suggest you to upgrade your React Native version as well.

MSetnik commented 1 year ago

buildToolsVersion = "30.0.2" minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31 ndkVersion = "21.4.7075529"

The problem is I cannot currently upgrade RN version because app depends on older plugins :/

kadiraydinli commented 1 year ago

@MSetnik Got it. Do you get this error when you try to use the setFitsSystemWindows function of this package in your project? Or are you getting this error when using a different function?

MSetnik commented 1 year ago

Still getting error after changing WindowCompat.setDecorFitsSystemWindows(view, enabled); to WindowCompat.setFitsSystemWindows(view, enabled);

node_modules/react-native-system-navigation-bar/android/src/main/java/com/reactnativesystemnavigationbar/SystemNavigationBarModule.java:289: error: cannot find symbol WindowCompat.setFitsSystemWindows(view, enabled); ^ symbol: method setFitsSystemWindows(Window,Boolean) location: class WindowCompat

App doesnt build because of that error

kadiraydinli commented 1 year ago

Have you tried using the previous version, version 2.5.2?

yarn add react-native-system-navigation-bar@2.5.2
dmitry-zaitsev commented 1 year ago

Same problem here. Works on 2.5.0, doesn't work on 2.6.0. Downgrading is not ideal since we would like to have this fix available:

https://github.com/kadiraydinli/react-native-system-navigation-bar/commit/6aeeca724f446f95e9380fe3e73aac311b7dfecf

kadiraydinli commented 1 year ago

Hi @MSetnik, @dmitry-zaitsev I made the change for this issue. You can test the change in the latest version 2.6.1

kadiraydinli commented 1 year ago

Update: I'm closing this issue assuming the issue has been resolved. If your problem persists, feel free to reopen the issue.