-
Notifications
You must be signed in to change notification settings - Fork 373
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
Not working on React Native 0.60 #792
Comments
+1 |
Facing the same issue after upgrading to React Native 0.60.
. |
Howdy, |
Actually i am trying to configure OneSignal React Native in react native application for the push notification purpose Environment Setup 1 : react-native version : 0.60 2 : npm version 10.5 I followed below official documentation of React native one signal for setting it up: step 1 : npm install -g react-native-cli, status : done step 2 : react-native init OneSignalDemo status : done (before linking project i ran my project successfully with below command ) react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res and react-native run-android While linking my library with react-native link react-native-onesignal i got a error in my terminal: Linking oneSignal with my App (As per official documentation) Package react-native-onesignal has been ignored because it contains invalid configuration. Create new react native project with version 0.58.0 as per documentation But i keep getting the same error. |
Other packages are having the same issue, maybe that helps you to fix it: |
Facing the same issue here, including that "react": "16.8.6", Whe I check OneSignal by [13:53:43] I | ReactNativeJS ▶︎ [Function: OneSignal], [Function: configure] |
Looking for some other similar problems... like react-native-firebase, I came to a solution that works perfectly with Android. I did not test yet for iOS: Create module.exports = {
dependencies: {
'react-native-onesignal': {
platforms: {
ios: { podspecPath: `${__dirname}/react-native-onesignal.podspec` },
android: {
/*"sourceDir": "./node_modules/react-native-onesignal/android",
"folder": "./node_modules/react-native-onesignal",*/
"packageImportPath": "import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;",
"packageInstance": "new ReactNativeOneSignalPackage()"
}
}
}
}
}; |
The problem is on Follow this steps to react-native 0.60 (Android):1. UnlinkIf you already use link, unlink the lib: 2. Create config fileCreate a file on project root called: On file react-native.config.js add this code: module.exports = {
dependencies: {
'react-native-onesignal': {
platforms: {
android: null,
// ios: null,
},
},
}
}; 3. Configure gradleGo to include ':react-native-onesignal'
project(':react-native-onesignal').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onesignal/android') 4. Add dependencies on build.gradleGo to 5. Import and add packageGo to On same file, find this code and add @Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new ReactNativeOneSignalPackage()); // <----- HERE
return packages;
} If you YET have problem, use jetify
Good luck :) |
I can confirm that it works on iOS by adding the following modifications: // react-native.config.js
module.exports = {
dependencies: {
'react-native-onesignal': {
platforms: {
ios: {
podspecPath: `${__dirname}/node_modules/react-native-onesignal/react-native-onesignal.podspec`,
},
android: {
packageImportPath: 'import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;',
packageInstance: 'new ReactNativeOneSignalPackage()'
},
},
},
},
}; |
+1 |
I did, but it didn't work.
|
Just did, but still the same error above. This is what was installed:
|
I had same problem and just removed the following lines from
|
This has been fixed in ec5035d Thanks for pointing it out! edit: We will be releasing the newest version of the react-native SDK with fixes very soon. If you would like to test the changes now, simply change your react-native-onesignal in your package.json to point to this repository.
Would love to hear your feedback prior to the release. Cheers! |
We just release version 3.3.0 which now includes this React Native 0.60 compatibility fix. |
Great thank you! |
@jkasten2 with the 3.3.+ version this:
^ this |
I didn't find that in RN0.61 |
Description:
Package react-native-onesignal has been ignored because it contains invalid configuration. Reason: Unknown option dependency.platforms.ios.sourceDir with value ""./ios"" was found. This is either a typing error or a user mistake
(your description here)
Environment
Steps to Reproduce Issue:
3.Run the app and you will get the error mentioned in the description
Anything else:
(crash stacktraces, as well as any other information here)
The text was updated successfully, but these errors were encountered: