-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Update for compatibility with React-Native 0.32 (Android) and fix local installation/building and local React-Native reference #502
Conversation
…tdated version from Maven -Update argument signature of RegionChangeEvent constructor to current react-native signature -Temporarily define maven url override in both build.gradle files until we restructure this to remove the lib folder
…t-native projects (for Android)
-Consistent maven URLs
Need this! |
@chrisknepper It looks great but, I'm might be wrong (I'm not very experienced in native development) but shouldn't Thanks for the help :) |
I can confirm this works by using your fork, and changing the following : removing changing your fork's Once again, I might be doing it wrong, but it might help. |
I successfully build my project by changing react-native version to |
No, did you properly change your package file to the fork? And then npm i again? |
@Exilz Yes, it may be better to use I guess I was just worried about a situation where maybe a future version of If you all want, I can make that change here. |
I guess that would be the best thing to do. |
…(since react-native versions increment quickly)
Done! As a side note, I'm having trouble getting my fork to install correctly on Android when using |
Yeah I had to tweak the changes made by |
this worked for me! thanks you too. |
So testing it just now, it The owners of this repo made a bunch of changes to the JS, so I'll need to update my PR... |
Okay, all resolved with the latest changes. It would be nice if the repo owners would consider merging this PR or at least acknowledging that there are people needing to use it on 0.32! Until then, you can use my version which works by referencing
I'm glad this is helpful to people! |
Awesome @chrisknepper! I just pinged @lelandrichardson about it and he said a co-worker who is working on maps will look at this shortly. |
We've been trying to get a new release for a while. For example #411 and I've got branches for RN 28, 29, and 30 to try to keep things up to date. This repo has so much awesome in it but it's starting to age a bit. @lelandrichardson have you considered PR this up to the React Native repo? It has a If you need help, I'd be happy to assist in any way I can. |
@skellock Agreed, this should ultimately be pulled into RN core and replace the iOS-only |
I'll take a look at this today! |
GROUP=com.airbnb.android | ||
|
||
POM_DESCRIPTION=React Native Map view component for Android | ||
POM_URL=https://github.com/lelandrichardson/react-native-maps/tree/new-scv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These POM
urls are 404ing. Does that matter? Should this point to a real URL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this doesnt matter much, it's only used by maven central, but since the lib will be pulled from node_modules, it's never used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spikebrehm This code was moved to android/gradle.properties
from android/lib/gradle.properties
. I don't think that the file POM_URL
points to ever existed, so it has always been 404ing, which you can see if you look at android/lib/gradle.properties
in master
.
I can update my PR to just remove this file entirely if you want, since it's optional.
looks good to me |
mavenLocal() | ||
jcenter() | ||
maven { | ||
url "$projectDir/../../react-native/android" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this should be url "$projectDir/../node_modules/react-native/android"
, right? same on line 26
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no, my change is correct. In this case, $projectDir
refers to <install location>/node_modules/react-native-maps/android
, so $projectDir/../../react-native/android
resolves to <install location>/node_modules/react-native/android
Putting url "$projectDir/../node_modules/react-native/android"
resolves to <install location>/node_modules/react-native-maps/node_modules/react-native/android
, a path which may not, and probably won't exist on end-user installs of this plugin. This is one of the things which causes Gradle to fetch the package from Maven, which isn't optimal.
@@ -1,2 +1,2 @@ | |||
include ':app', ':react-native-maps' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change caused building the example app to fail. Adding back ':app',
fixed it. Once this is changed back, we can merge!
Nevermind about this error:
That was from |
Done :) |
Great, thanks for your contribution! @chrisknepper 🍻. We can always use help maintaining the Android side of this project! |
yay thanks @chrisknepper! |
So in summary, with RN 0.32, what do we need to do please? |
@npomfret Follow installation.md, everything works fine with the latest release (0.8.0) on RN 0.32. |
Thank you both @spikebrehm and @felipecsl and everyone in this thread for helping with this update 😀 I think this project is great work and I'm happy to be a part of it! IMO one of the most important aspects of this project is that it supports both platforms. |
After I upgraded my project to latest rn-maps Im getting this exception
|
@veedeo you're most likely not using RN 0.32.0. |
Im on windows, but npm list returns what I did to upgrade, is manually changed versions in package.json and run npm install |
you have to check what version of react native was resolved by gradle, since that's what is gonna be packaged into your apk. There is no guarantee that the one listed by npm is the right one, you have to run the gradle task I showed above in order to see it |
|
In #502, the local maven url pointing to the `react-native` node module changed to work better for the example app. However, that broke the path to `react-native` when developing in the context of the library, not the example app. In this PR, specify both paths.
In react-native-maps#502, the local maven url pointing to the `react-native` node module changed to work better for the example app. However, that broke the path to `react-native` when developing in the context of the library, not the example app. In this PR, specify both paths.
Awesome job with the new release! Looks like a version bump was missed in one place. 😉 |
@charpeni |
🤦 |
This pull request seeks to address two issues with
react-native-maps
on Android.react-native
, the constructor signature for the UI Event class changed, causingMapView
to crash upon rendering. This is addressed in Update RegionChangeEvent to work with RN 0.32.0-rc #450 and that code change is also included here.compile 'com.airbnb.android:react-native-maps:0.7.1'
That syntax, combined with the way that the plugin had been structured causes problems. Gradle doesn't recurse/ignores the
settings.gradle
in this plugin file telling it to includelib
, which means that before this change, a user would also need to include this in their app'sandroid/settings.gradle
file:Which almost works, but since then it only looks in
lib
, it ignores thebuild.gradle
in the plugin root telling it where to find the localreact-native
. These problems combine in a way which causes this plugin to download and referencereact-native
from Maven, not locally.On Maven, the newest version of
react-native
available is 0.20.1. If Gradle gets it from there instead of locally (i.e. 0.32), it fails to build because of the signature change I refer to in point 1.So bottom line we should reference
react-native
from the peer node_modules folder, and encourage users of the plugin include it in theirapp/build.gradle
files the new way:android/app/build.gradle
:compile project(':react-native-maps')
android/settings.gradle
: