-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React Native 0.73 npx rnn-link
doesn't work
#7821
Comments
+1 |
Mesmo problema |
+1 |
The issue is that the following line in path.js assumes that I was able to get around this issue by changing this line... var mainApplicationJava = glob.sync('**/MainApplication.java', ignoreFolders)[0]; to the following: var mainApplicationJava = glob.sync('**/MainApplication.{java,kt}', ignoreFolders)[0]; This way the glob.sync func matches both file extensions. |
+1 |
Same here |
+1 |
is this issue has been solved ? |
i still have this issue as well |
All, please track #7834 for the official RN73 support 🙏🏻 |
Hey guys, FYI the similar bug is back / regressed, apologies for appending to this issue. Note, I am using And I tried using
Error output in terminal /private/var/www/rndemoapp0745/node_modules/react-native-navigation/autolink/postlink/path.js:10
exports.rootGradle = mainApplicationJava.replace(/android\/app\/.*\.java/, 'android/build.gradle'); Dependency versions installed (with "dependencies": {
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.74.5",
"react-native-navigation": "^7.40.1"
} Temporary solution test To change the var mainApplicationJava = glob.sync('**/MainApplication.{java,kt}', ignoreFolders)[0]; Thanks a bunch @jtich! |
We're planning to revisit this in the future, but it's going to take a while. We could really use some help from the community with this one, we don't have immediate capacity to address these kind of issues 🙏🏻 |
+1 |
To avoid directly modifying the file in the node_modules folder, I created a postinstall script based on @jtich comment. This script automates the fix for Kotlin support in rnn-link:
"scripts": {
"postinstall": "node scripts/fix-path.js"
}
/**
* Fixes an issue with the react-native-navigation's rnn-link command.
* Reference: https://github.com/wix/react-native-navigation/issues/7821#issuecomment-1865390682
*/
const fs = require('fs');
const path = require('path');
// Path to the path.js file
const filePath = path.join(__dirname, '..', 'node_modules', 'react-native-navigation', 'autolink', 'postlink', 'path.js');
// Replaces the code to support .kt files
fs.readFile(filePath, 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
const result = data.replace(
'var mainApplicationJava = glob.sync(\'**/MainApplication.java\', ignoreFolders)[0];',
'var mainApplicationJava = glob.sync(\'**/MainApplication.{java,kt}\', ignoreFolders)[0];'
);
fs.writeFile(filePath, result, 'utf8', function (err) {
if (err) {return console.log(err);}
console.log('Fix applied to path.js for Kotlin support.');
});
});
yarn install # or yarn postinstall |
Even though
|
Why this is not merged? |
@rendomnet Because it useless and helps to skip error message, without applying a Kotlin liker code |
Workaround: You can use a tmp. ver with a fixed # install a version with a fix
yarn add react-native-navigation@https://github.com/retyui/react-native-navigation.git#feat/retyui/add-kotlin-autolinker
# do linking
npx rnn-link
# restore prev. version of RNN
yarn add react-native-navigation # or use our own version |
@retyui Could you confirm that is it working with react-native 0.76.3? Becuase in my case it is not. |
Did you found a solution? |
@rendomnet It's known problem, and you can find many solutions in github issues. Try searching it to see how to fix it. |
What happened?
starting from rn73
*.java
files was convened to*.kt
so auto-linking doesn't work properly
What was the expected behaviour?
no js error,
*.kt
files supported out of the boxWas it tested on latest react-native-navigation?
Help us reproduce this issue!
No response
In what environment did this happen?
React Native Navigation version: 7.37.2
React Native version: 0.73
Has Fabric (React Native's new rendering system) enabled: (yes/no)
Node version: 18
Device model:
Android version:
The text was updated successfully, but these errors were encountered: