Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

DIsplay a map full of stations and let a user select a station to view data at that station. #14

Closed
wants to merge 11 commits into from

Conversation

ryancoughlin
Copy link
Owner

No description provided.

@ryancoughlin ryancoughlin changed the title Rc map pins DIsplay a map full of stations and let a user select a station to view data at that station. Apr 8, 2017
@@ -28,7 +28,7 @@ const StationDetail = class extends Component {
}

componentDidMount() {
this.findCurrentLocation()
this.requestLoctionInformation()
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BlakeWilliams I am calling this on mount so it kicks off the first time (when you open the app for the first time). If you then select a new location via the map, this works as well. Lastly, while within this same state you go to the map and pick another station nothing happens. You see the new screen come in, but no actions are fetched.

Thinking about this now, this is accurate since the component is already mounted? But at the same time that is odd because it works once then stops.

I was hooking into componentWillReceiveProps and that was fired way too much due to the reducer setting the props after various actions were completed.

Could I still use that method above but do some logic to compare this.props and nextProps basically:

if (this.props.location !== this.nextProps) { // kick off a new request }

(Also as I was writing this I thought of that solution, another reason PR's and code reviews are so great. I have had this happen a few times).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you need two different components. One that fetches current location on mount and another that fetches the one from props?

@ryancoughlin
Copy link
Owner Author

Found this PR to address the pin issue. Looks like they are allocating a new UIImage each time a marker is generated (even with it using the same asset) 🤷‍♂️

react-native-maps/react-native-maps#1187

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants