Uh oh!
There was an error while loading. Please reload this page.
[MapView] Support for annotation callouts, annotation press, callout presses and pin animation - #1247
[MapView] Support for annotation callouts, annotation press, callout presses and pin animation#1247dvcrn wants to merge 4 commits into
Conversation
facebook-github-bot
commented
May 12, 2015
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks! |
facebook-github-bot
commented
May 12, 2015
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
brentvatne
commented
May 30, 2015
@dvcrn - Nice one! Sorry for the lack of love on this PR - could you possibly squash your commits and rebase against master? Thanks! |
chandu0101
commented
May 30, 2015
@dvcrn excellent , this is what i am looking for :) |
dvcrn
commented
Jun 7, 2015
@brentvatne Squashed and rebased current master |
brentvatne
commented
Jun 15, 2015
- added didSelectAnnotationView event to MapView - only pass annotation data onAnnotationPress - added support for callouts in annotations and callout click handling - passing annotation id on annotation click - added check for MKuserLocation - added project.pbxproj changes - fixed flowtype errors - fix componentWillReceiveProps not updating annotations correctly - added option to animate pin drop - fix callouts not showing when no accessory is set - noone saw that :) - added a real identifier rather than using the annotation one - added missing type annotations
dvcrn
commented
Jun 16, 2015
@a2 ping 😄 |
…letely re-setting them
dvcrn
commented
Jun 17, 2015
I am working a lot with mapview lately and found some more annoyances so why not squeeze them in here as well? I updated I tried object comparison (as in Now the problem: Working on this change made me realize that the identifier system I currently have in place is a bit flawed. If the user sets his own ID, the pins will not change. If the user does not do that and relies on the auto-id I am generating, it will re-add a new ID every time the annotation array changes since it will wipe the unique-id of that annotation and generate a new one. I decided to replace the unique uuid with a hash containing a JSON.stringify representation of the annotation object. I'd love to hear some feedback on this. The good thing about this solution is, that same objects have same hashes and it is no longer random. This allows for the same pin to have the same identifier through the entire app flow, even if the user replaces the object reference with a new one (e.g. on ajax fetch). No more jumpy pins! The bad thing is, that if 2 pins are identical, the event system could fail and only 1 callback is getting executed. Though this can only happen if literally 2 pins are on the same lat, long with the same title and subtitle which... well... shouldn't happen. TODO is to base64 encode that hash, but |
a2
commented
Jun 17, 2015
This PR was imported internally but @nicklockwood had some comments. Nick, can you make those comments here? |
dvcrn
commented
Jun 18, 2015
Thanks for the feedback, I'll try to get the stuff fixed the next days |
brentvatne
commented
Jun 18, 2015
Awesome 😄 thanks @dvcrn |
dvcrn
commented
Jun 22, 2015
Ok I think I got them all |
bparadie
commented
Jun 22, 2015
@dvcrn Hey, I think I know a workaround for the Travis CI failures. Those have nothing to do with your code changes. You have to add this line to the dependencies in For more details, see #1546 (comment) |
a2
commented
Jun 25, 2015
Merged internally. |
Split rn-tester build into debug and release
Split rn-tester build into debug and release
Merge pull request react#1247 from rasaha91/split-rn-tester
Started from here - #1120. Most functionality for annotations were missing so I started implementing and somehow got caught up until the entire thing was done.
2 new events:
6 new properties for annotations:
1 new property for MapView
Now the important thing is, that I implemented all of this the way "I would do it". I am not sure this is the 'reacty' way so please let me know my mistakes 😄
The problem is that there is no real way to identify annotations which makes it difficult to distinguish which one got clicked. The idea is to pass a
idand whether it has callouts the entire way with the annotation. I had to subclassMKAnnotationfor this and implemented a customRCTPointAnnotationwhich addsid,hasLeftCallout,hasRightCalloutandanimateDrop.I added
RCTPointAnnotationandRCTPointAnnotationArrayinto a newRCTConvertmethod.The user is able to overwrite the id on the annotation directly, but if no id is set, I am generating one on
componentWillMountorcomponentWillReceiveProps. This id will also get passed intoonAnnotationPressI am setting the callout accessory always to
UIButtonTypeDetailDisclosure. Todo at some point would be to allow custom UIButtons and Images