infinitered / solidarity-react-native

Solidarity snapshot plugin for React Native projects
MIT License
48 stars 10 forks source link

fix errors with android in newer react native versions #25

Closed DanielMSchmidt closed 5 years ago

DanielMSchmidt commented 6 years ago

Newer RN versions use the

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
}

syntax which was not supported and lead to an immediate exit.

Without the fix this error got thrown:

TypeError: Cannot read property '1' of null
    at module.exports (/Users/danielschmidt/projects/private/solidaritydemoproject/node_modules/solidarity-react-native/extensions/helpers/getAndroidEnvData.js:12:72)
    at Object.check (/Users/danielschmidt/projects/private/solidaritydemoproject/node_modules/solidarity-react-native/extensions/react-native.js:28:15)
    at Object.<anonymous> (/Users/danielschmidt/projects/private/solidaritydemoproject/node_modules/solidarity/dist/extensions/functions/checkRequirement.js:124:72)
    at Generator.next (<anonymous>)
    at /Users/danielschmidt/projects/private/solidaritydemoproject/node_modules/solidarity/dist/extensions/functions/checkRequirement.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/danielschmidt/projects/private/solidaritydemoproject/node_modules/solidarity/dist/extensions/functions/checkRequirement.js:3:12)
    at map (/Users/danielschmidt/projects/private/solidaritydemoproject/node_modules/solidarity/dist/extensions/functions/checkRequirement.js:62:44)
    at _map (/Users/danielschmidt/projects/private/solidaritydemoproject/node_modules/ramda/src/internal/_map.js:6:19)
    at map (/Users/danielschmidt/projects/private/solidaritydemoproject/node_modules/ramda/src/map.js:64:14)

My prettier went a bit through the roof, if that's not cool I can redo the changes without prettier being active.

morgandonze commented 6 years ago

@DanielMSchmidt thanks for your PR. I'll test it out and merge if successful.

morgandonze commented 6 years ago

@DanielMSchmidt I tested with RN 0.57.3 and didn't receive the type error you showed. Could you tell What version were you using please?

DanielMSchmidt commented 6 years ago

So I tested it with a react-native init created app with 0.57.2. I uploaded it here: https://github.com/DanielMSchmidt/solidaritytestproject and I am 100% certain I did nothing fancy with it 😇

morgandonze commented 5 years ago

Thanks for your patience, @DanielMSchmidt. We were out last week at our yearly retreat. I tested this again and it worked. I'm just going to see if anyone else wants to review before I merge.

DanielMSchmidt commented 5 years ago

@GantMan Sorry for the prettier 🙈 I really need to disable it by default :D