Uh oh!
There was an error while loading. Please reload this page.
[MapView] add image support for annotation callouts, refactored config - #1907
[MapView] add image support for annotation callouts, refactored config#1907dvcrn wants to merge 15 commits into
Conversation
dvcrn
commented
Jul 9, 2015
Hmm, looks like I forgot about support for normal urls that are not project resources. I'll try to add that in the next days |
sahrens
commented
Jul 15, 2015
I realize this is just an extension of the style from #1247, but what do you think about making the callouts react components? Then we could support arbitrary callouts instead of just images and buttons. The way we typically do that is to pass the special views as children, then in native insertReactSubview we would grab the callout views and set them as the accessory views. You can differentiate the callout views from normal children/subviews by passing the tag IDs of the callouts as a prop to the parent MapView. I know that's a lot of work, so we can potentially keep this approach for now and change the API/approach later. Also, can you remove all unrelated changes to babel, podspec, etc? |
sahrens
commented
Jul 15, 2015
Passing to @a2 who handled the last one, and cc @nicklockwood and @vjeux for thoughts on API. |
sahrens
commented
Jul 15, 2015
Also, can you add usage of this stuff to the map example? |
dvcrn
commented
Jul 16, 2015
Okay finally got the code in a state I'm happy with. I think using react components is a really cool idea and definitely something to add in the long term. When I started I didn't know how to implement this kind of behavior so went with the simpler solution to extend the API. I'll edit the map example when I'm back home later the day. |
dvcrn
commented
Jul 22, 2015
Okay, cleaned the commits up and removed stuff that shouldn't be there. Also added some simple usage to MapViewExample.js |
dvcrn
commented
Jul 29, 2015
ping @a2. Anything else needed for this? 😄 |
a2
commented
Jul 29, 2015
@facebook-github-bot import |
facebook-github-bot
commented
Jul 29, 2015
Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/102516373428940/int_phab to review. |
a2
commented
Jul 29, 2015
@vjeux Can you look at the JavaScript API for this? I think we could DRY up the duplicate code for the two shapes, and I'm not sure if the inner "config" dictionary is necessary. |
vjeux
commented
Jul 29, 2015
I'm also with the opinion of @sahrens, at this point we're adding a lot more configurations to the popup and instead of hardcoding all those, it would be better to let the user render an arbitrary React component inside. This way we don't need to add a lot of complexity to that component that's not going to match all the use cases and instead provide a generic way to extend it. What do you think? |
a2
commented
Jul 29, 2015
That sounds good. Better to just put in arbitrary components that the user can specify. |
a2
commented
Jul 30, 2015
@vjeux What do we want to do with this PR then? |
dvcrn
commented
Jul 30, 2015
I'll try to take a look at how to pass a react component to the annotation once I'm a bit more free on time. Do you guys have a class/component somewhere where this has already been done for reference? |
nicklockwood
commented
Jul 30, 2015
@dvcrn this is actually not a simple problem, and it's something I've been investigating. The problem is that unless a (non-root) React component is a direct descendant of another component, it's won't get processed by the resolver or layout system. Ideally it would work like this: But due to the aforementioned limitations, I think it would actually have to be more like this: i.e. the whole annotation would need to be a component in its own right, and a child of the MapView, otherwise it won't get processed correctly. @vjeux, does that sound right? Or am I missing something? Maybe there's a way to hide this implementation detail? |
vjeux
commented
Jul 30, 2015
Yeah this is annoying, I'm pretty sure that it hasn't been designed that way but it is just the result of the current way it is implemented and can be fixed |
dvcrn
commented
Jul 31, 2015
I see, thanks for the explanation. Besides that, is this PR in a usable state until that kind of functionality can be implemented or should we directly try to add the annotation view as a react component? |
dvcrn
commented
Aug 14, 2015
Ping. Is there anything I can help with here? |
a2
commented
Aug 14, 2015
I think we should close this until we have proper support for components in callouts. @nicklockwood and @vjeux, thoughts? |
There was a problem hiding this comment.
@machard good point and thanks for the comment. But since this PR is 'on hold', I am not sure whether it's worth changing the code now or just wait for react components in callouts
dvcrn
commented
Sep 14, 2015
I read a bit through the code and found that TabBarIOS (http://facebook.github.io/react-native/docs/tabbarios.html#content) is implemented very similar and a good reference in how this could look later on. To clarify, is the behaviour we want for this? Not that I start and waste my time with this :p |
edcs
commented
Sep 30, 2015
That sort of thing would be ideal for me - I've had a go at implementing it myself but I got a bit stuck. |
Summary: public The dev mode override feature was built with the assumption that bunlded JS would be minified, and broke with unminified JS. This fixes that by using a more robust regex-based search. Reviewed By: tadeuzagallo Differential Revision: D2581240 fb-gh-sync-id: 4d4b45eb8573ceb956b7259550d80a9807f83d59
…tons, further prepared for more types of accessories
- offloaded image generation for callouts into a separate function to reduce code size by a good chunk. - Fixed default images not getting used correctly - Added status code check for remote images
facebook-github-bot
commented
Nov 6, 2015
@dvcrn updated the pull request. |
dvcrn
commented
Nov 6, 2015
no more silent updates, huh? 😄 Should I close this PR? |
satya164
commented
Dec 22, 2015
Any updates on this? |
satya164
commented
Jan 26, 2016
Closing since no activity on the PR. let's re-open if you wanna work on it again. |
nicklockwood
commented
Jan 26, 2016
Custom callouts views are supported now on iOS, so this PR is now moot. |
dvcrn
commented
Jan 27, 2016
yup - not necessary anymore |
Addition / refactor to #1247
I realized while using the new callouts that support for images is still missing and that more callout types might get added in the future which is a bit awkward with the old config method. Refactored the code a bit and added image support to make sure there won't be bigger issues later on.
Example:
Difference from the last version
becomes to
typefor allowing to pick the accessory type (currentlybuttonandimage)on...CalloutPressinto new config underonPressconfigsub object for passing additional parameters to the accessory. Currently supported areimagewhen type is image, anddefaultImagewhenimageis not a local ressource