react-native-check-version icon indicating copy to clipboard operation
react-native-check-version copied to clipboard

getting error on Android

Open mubashiralisiddiqui opened this issue 2 years ago • 5 comments

"react-native-check-version": "^1.1.1", "react-native": "0.66.5", { platform: 'android', bundleId: 'com.tntmobile', version: null, needsUpdate: false, notes: '', url: null, lastChecked: '2023-05-28T12:37:39.902Z', country: 'fr', error: [TypeError: Cannot convert null value to object] }

in node modules here is the issue const text = await res.text(); const version = text.match(/[[['"['"]]],/)[1]; getting null while applying the regex

mubashiralisiddiqui avatar May 29 '23 09:05 mubashiralisiddiqui

~~Hi, I got the same on my project "error": [TypeError: null is not an object (evaluating 'text.match(/\[\[\[['"]((\d+\.)+\d+)['"]\]\],/)[1]')]~~

adrienGzc avatar Jun 09 '23 14:06 adrienGzc

I actually found the issue for my case. My version number was 2.2.3 (XXX) displayed on the Google Play Store page. Without the (XXX) the regex works just fine. I change the regex to match my case and also work like before by adding this (\s\(\d+\))? so the regex now looks like this \[\[\[['"]((\d+\.)+\d+)(\s\(\d+\))?['"]\]\].

@tschoffelen are you interested in having the changes in your package? If so I can make a PR for the changes. Let me know 🙂

adrienGzc avatar Jun 09 '23 17:06 adrienGzc

Hi @adrienGzc! Good find!

Definitely happy to accept PRs. One thing to keep in mind though is that I don't think that's a valid semver, so might also need to see if that causes problems with the version comparison logic.

tschoffelen avatar Jun 09 '23 18:06 tschoffelen

Let me check how this behaves, I'll let you know 🙂

adrienGzc avatar Jun 12 '23 08:06 adrienGzc

If you're willing to open a PR with this change that would be amazing!

tschoffelen avatar Mar 31 '24 17:03 tschoffelen