iaphub / react-native-iaphub

The easiest way to implement IAP (In-app purchase) in your React Native app.
https://www.iaphub.com/
MIT License
317 stars 21 forks source link

Unexpected token in iaphub.tsx #129

Closed fabian0409 closed 1 year ago

fabian0409 commented 1 year ago

Hi all,

first of all: I'm pretty sure that the issue is on my end, but I'm completely lost...

I've updated to version v7.0.14 and ever since I'm seeing attached Error message in the emulator. My react-native version is 0.61.5 and I've had to set the SWIFT_VERSION (by creating an empty Swift file) and add the following code to the Podfile to allow me to pod install:

pod "React-Core", :path => "../node_modules/react-native/", :modular_headers => true

I've cleaned the build folder and then built the app from XCode.

iap-hub-screenshot

Any help would be greatly appreciated.

iaphub commented 1 year ago

Hi @fabian0409, To be honest we've never seen this issue before so it is pretty difficult to help. It seems like for some reason you're loading the files in the src directory of the module, it should instead load the files in the lib directory (compiled files). I would also recommend using the latest version of the library (8.1.4).

fabian0409 commented 1 year ago

Thanks for your reply @iaphub. I've never seen it before either, that's why I'm asking for help. ;)

I've updated to version 8.1.4 and I'm still seeing the same issue for both iOS and Android. Everything worked fine with v6.2.1 and I did not change anything in the overall project config. Do you have any idea why the files are being loaded from the src instead of the lib directory? Unfortunately I have absolutely no clue how to solve this issue.

iaphub commented 1 year ago

We were not using typescript in the v6 of the library, which is probably why it used to work on your project. Your React Native dependency is pretty old, I would recommend updating it.

fabian0409 commented 1 year ago

Thanks for pointing me in the right direction @iaphub. I had to update @babel/core and @babel/runtime like this:

"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/runtime": "^7.9.2",
//other dev dependencies
}

I found this information in the following comment: https://github.com/react-native-device-info/react-native-device-info/issues/1167#issuecomment-1205535417

Just wanted to leave it here in case anyone else is having a similar issue.

iaphub commented 1 year ago

Thanks for sharing @fabian0409, happy to hear you found the issue 👍