Reference Source
public class | source

MapView

Extends:

* → MapView

Class for the Map view

Constructor Summary

Public Constructor
public

Create an instance of LoginView

Member Summary

Public Members
public

MapP: *

public

Triggers when the component is mounted.

public

Component's state has updated

public
public

Component will receive new properties via the props attribute

public

Component is about to unmount, do any cleanup here.

public

navigate(screen: string): *

Navigate to a page with a title.

public

newMarker(latitude: Integer): *

helper function of _onPinMarkerPress

public

onMarkerDragEnd(coord: Object): *

Triggers after a marker being dragged has stopped being dragged.

public

onRegionChange(A: region): *

Change region state as moving the map

public

Refreshes the state of the component so new data is fetched.

public

Render a searchbar for user to search location after clicking "search location" button

public

Resets the state with default variables

Private Members
private

Creates a new marker from the data.

private

_getColourString(colours: List): string: *

Get the string to display from the colours list.

private

handle click event after clicking "create marker" button

private

_onSelectedItemsChange(selectedFilters: List): *

Add the new selected items to the state and update

private

Renders the action button add icon.

private

Renders the action button icon pin.

private

Renders the callout for a marker.

private

Renders the cancel action button

private

Renders the save action button

private

_setLocationToMarkerItem(refs: List, item: Object, shouldReshowCallout: Boolean): *

Sets the location of the map to the marker's position and open its callout.

private

_setMarkers(selectedFilters: List): *

Sets markers according to the filter, if any, that is set.

private

Sets the state to the profile data retrieved from the model.

private

Sets the user's location to their current location.

private

Toggle the notification area.

Method Summary

Public Methods
public

Delete created marker or circle after clicking delete button

public

render()

Extract data from the component's view and send an update to the presenter to do any logic before sending it to the model

public

Render a circle to set notification receiving area

public

Save data of created marker or circle after clicking save button

public

Save data of circle to notification settings

public

Save data of created marker to report lost page

public

Long press the map to change the coordinate of circle

Public Constructors

public constructor(props: Object) source

Create an instance of LoginView

Params:

NameTypeAttributeDescription
props Object

Component properties

Public Members

public MapP: * source

public componentDidMount: * source

Triggers when the component is mounted.

public componentDidUpdate: * source

Component's state has updated

public componentWillMount: * source

public componentWillReceiveProps: * source

Component will receive new properties via the props attribute

public componentWillUnmount: * source

Component is about to unmount, do any cleanup here. Call viewUnmounting in base class so it can do any cleanup for the view before calling the presenter destroy method

public navigate(screen: string): * source

Navigate to a page with a title. This method is used over the commented out line below because successive touches of a bike item would not add the data because data is only received in process in the componentWillMount function. So adding the 'key' property to navigate makes it see that the new page is unique.

public newMarker(latitude: Integer): * source

helper function of _onPinMarkerPress

public onMarkerDragEnd(coord: Object): * source

Triggers after a marker being dragged has stopped being dragged.

public onRegionChange(A: region): * source

Change region state as moving the map

public refreshState: * source

Refreshes the state of the component so new data is fetched.

public renderSearchbar: * source

Render a searchbar for user to search location after clicking "search location" button

public resetState: * source

Resets the state with default variables

Private Members

private _createNewMarker(data: Object): Object: * source

Creates a new marker from the data.

Return:

Object

A new marker object with data, key and coordinate properties

private _getColourString(colours: List): string: * source

Get the string to display from the colours list.

Return:

string

A string obtained from the colours in the list

private _onPinMarkerPress: * source

handle click event after clicking "create marker" button

private _onSelectedItemsChange(selectedFilters: List): * source

Add the new selected items to the state and update

private _renderActionButtonAddIcon: * source

Renders the action button add icon.

private _renderActionButtonPinIcon: * source

Renders the action button icon pin.

private _renderCallout(item: Object): * source

Renders the callout for a marker.

private _renderCancelActionButton: * source

Renders the cancel action button

private _renderSaveActionButton: * source

Renders the save action button

private _setLocationToMarkerItem(refs: List, item: Object, shouldReshowCallout: Boolean): * source

Sets the location of the map to the marker's position and open its callout.

private _setMarkers(selectedFilters: List): * source

Sets markers according to the filter, if any, that is set.

private _setProfileImage: * source

Sets the state to the profile data retrieved from the model.

private _setUserLocation: * source

Sets the user's location to their current location.

private _toggleCircle: * source

Toggle the notification area.

Public Methods

public deleteItem() source

Delete created marker or circle after clicking delete button

public render() source

Extract data from the component's view and send an update to the presenter to do any logic before sending it to the model

public renderCircle() source

Render a circle to set notification receiving area

public saveItem() source

Save data of created marker or circle after clicking save button

public sendCircle() source

Save data of circle to notification settings

public sendNewMarker() source

Save data of created marker to report lost page

public setCircleLat(e: Object) source

Long press the map to change the coordinate of circle

Params:

NameTypeAttributeDescription
e Object

The event of long press on the map