Reference Source
public class | source

AddBikeView

Extends:

* → AddBikeView

Class for the AddBike view

Static Member Summary

Static Public Members
public static

Set the navigation options, change the header to handle a back button.

Constructor Summary

Public Constructor
public

Creates an instance of the add bike view

Member Summary

Public Members
public
public

alertCallback(success: Boolean): *

Sets a callback on what to do if there is a success or error when a bike is uploaded.

public

Component mounted

public

Component is about to mount, initialize the data.

public

Component will unmount after this method is called, do any clean up here Call viewUnmounting in base class so it can do any cleanup for the view before calling the presenter destroy method

public

deleteCallback(success: Boolean): *

Sets a callback on what to do if there is a success or error when a bike is uploaded.

public

Prompt to ask the user if they want to delete the bike

public

A function to execute when the editing state is false.

public

A function to execute when the editing state is true.

public

Checks if the title of the view is edit bike, and if so, returns true.

public

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

public

Resets all the data and goes back to the bike page

public

setEditing(edit: Boolean): *

Set the editing value to the passed in value.

public

state: *

public

Toggle the editing mode.

Private Members
private

Clears all the data

private

Disables the loader.

private

Enables the loader.

private

DON'T USE THIS METHOD UNLESS ABSOLUTELY NECESSARY. Force a refresh of the view.

private

Get the data from the state and send an update to the presenter

private

Alert for requirement input failure

private

_keyExtractor(item: Object, index: Number): *

Extract the key from the item and index

private

_onBack: *

When the back button is clicked, check if the user was editing.

private

_onSelectedItemsChange(selectedItems: List): *

Add the new selected items to the state and update

private

_renderItem(item: Object): Component: *

Render a text input item.

private

_renderName(name: string): Component: *

Renders the name of a required field.

private

_renderText(colour: string, name: string): Component: *

Generates the style and colouring of the colours in the multiselect.

Method Summary

Public Methods
public

render(): Component

Renders items to the screen

Static Public Members

public static navigationOptions: Object: * source

Set the navigation options, change the header to handle a back button.

Return:

Object

Navigation option

Public Constructors

public constructor(props: Object) source

Creates an instance of the add bike view

Params:

NameTypeAttributeDescription
props Object

Component properties

Public Members

public AddBikeP: * source

public alertCallback(success: Boolean): * source

Sets a callback on what to do if there is a success or error when a bike is uploaded.

public componentDidMount: * source

Component mounted

public componentWillMount: * source

Component is about to mount, initialize the data. This function is called before componentDidMount

public componentWillUnmount: * source

Component will unmount after this method is called, do any clean up here Call viewUnmounting in base class so it can do any cleanup for the view before calling the presenter destroy method

public deleteCallback(success: Boolean): * source

Sets a callback on what to do if there is a success or error when a bike is uploaded.

public deletePrompt: * source

Prompt to ask the user if they want to delete the bike

public editingFailure: * source

A function to execute when the editing state is false.

public editingSuccess: * source

A function to execute when the editing state is true.

public isEditBikePage(title: string): Boolean: * source

Checks if the title of the view is edit bike, and if so, returns true.

Return:

Boolean

true: If the page is edit bike; false: If the page is add bike

public refreshState: * source

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

public resetAllOnBack: * source

Resets all the data and goes back to the bike page

public setEditing(edit: Boolean): * source

Set the editing value to the passed in value.

public state: * source

public toggleEditing: * source

Toggle the editing mode.

Private Members

private _clearData: * source

Clears all the data

private _disableLoader: * source

Disables the loader.

private _enableLoader: * source

Enables the loader.

private _forceRefresh: * source

DON'T USE THIS METHOD UNLESS ABSOLUTELY NECESSARY. Force a refresh of the view.

private _getDataToUpdate: * source

Get the data from the state and send an update to the presenter

private _inputRequirementFailure: * source

Alert for requirement input failure

private _keyExtractor(item: Object, index: Number): * source

Extract the key from the item and index

private _onBack: * source

When the back button is clicked, check if the user was editing.

private _onSelectedItemsChange(selectedItems: List): * source

Add the new selected items to the state and update

private _renderItem(item: Object): Component: * source

Render a text input item.

Return:

Component

A react component

private _renderName(name: string): Component: * source

Renders the name of a required field.

Return:

Component

A react component

private _renderText(colour: string, name: string): Component: * source

Generates the style and colouring of the colours in the multiselect.

Return:

Component

A react component

Public Methods

public render(): Component source

Renders items to the screen

Return:

Component