new Component()

Description
NOTE:
If overriding componentWillUnmount or componentWillUpdate, you must call the appropriate super method - super.componentWillUnmount() or super.componentWillUpdate(nextProps, nextState), respectively.
Properties
Name Type Default Description
autoReset boolean true (static) Whether to automatically reset the navigation bar upon component display. (defaults to true)
navigationOptions NavigationBar (static) The navigation bar for this component. Defaults to a title of "Untitled" with no right Buttons.
Examples
import {Component} from 'ern-navigation';
			
			export default class MainScreenComponent extends Component {
			  static displayName = 'Main Screen';
			  static autoReset = true;
			  static navigationOptions = {
			    title: 'My Application',
			    buttons: [
			      {
			        icon: Image.resolveAssetSource(exitIcon).uri,
			        id: 'exit',
			        location: 'right',
			        adaLabel: 'Exit this app',
			      },
			    ],
			  };
			
			  onNavButtonPress(buttonId) {
			    switch (buttonId) {
			      case 'exit':
			        this.finish();
			        break;
			      default:
			        console.warn(
			          `'${buttonId}' not handled in '${MainScreenComponent.getRegisteredRoute()}'`,
			        );
			        break;
			    }
			  }
			}
Details

React.Component

Methods


<static> setRegisteredRoute( route )

Description
Set the registered route for this component.
Parameters
Name Type Description
route string The registered route for this component.

<static> getRegisteredRoute() → {string}

Description
Get the registered route for this component.
Returns
A string containing the registered route for this component.

<static> setAppNavigator( appNavigator )

Description
Set the AppNavigator for this component.
Parameters
Name Type Description
appNavigator AppNavigator The AppNavigator for this component.

<static> getAppNavigator() → {AppNavigator}

Description
Get the AppNavigator for this component.
Returns
The AppNavigator for this component.

<abstract, static> getDynamicTitle( jsonPayload )

Description
Calculate the title for the current route based on the JSON payload. Must be overridden in subclasses.
Parameters
Name Type Description
jsonPayload Object The JSON payload for the current route.

<abstract, static> onNavButtonPress( buttonId )

Description
Handle button press events. Must be overridden in subclasses.
Parameters
Name Type Description
buttonId string The ID of the button which was pressed.

<abstract, static> onFocus()

Description
Handle focus events.

<abstract, static> onBlur()

Description
Handle blur events.

<abstract, static> onAppData()

Description
Handle appData events.

<async> resetNavigationBar() → {Promise}

Description
Reset the navigation bar for the current screen to its defaults.
Returns
A Promise which will resolve or reject upon attempting to reset the navigation bar.

<async> updateNavigationBar( navigationBar ) → {Promise}

Description
Update the navigation bar for the current screen.
Parameters
Name Type Description
navigationBar NavigationBar The NavigationBar object.
Returns
A Promise which will resolve or reject upon attempting to update the navigation bar.

Description
Navigate to a given route.
Parameters
Name Type Description
route Object The route object that details where to navigate next.
Returns
A Promise which will resolve or reject upon attempting to navigate to the given route.

Description
Navigate to an internal screen.
Parameters
Name Type Attributes Description
screenName string The name of the screen to navigate to; these names should be defined in the initial AppNavigator setup.
jsonPayload Object <optional>
(optional) The JSON payload with props to send to the new screen.
options RouteOptions <optional>
(optional) Additional route options.
Returns
A Promise which will resolve or reject upon attempting to navigate to the new screen.

<async> backTo( screenName ) → {Promise}

Description
Go back to a specified screen.
Parameters
Name Type Description
screenName string The name of the screen to navigate to; these names should be defined in the initial AppNavigator setup.
Returns
A Promise which will resolve or reject upon attempting to go back to the specified screen.

<async> back() → {Promise}

Description
Go back one screen.
Returns
A Promise which will resolve or reject upon attempting to go back one screen.

<async> finish( [ payload ] ) → {Promise}

Description
Finish this flow.
Parameters
Name Type Attributes Description
payload Object <optional>
(optional) The JSON payload to send to the native activity or view controller that launched the flow.
Returns
A Promise which will resolve or reject upon attempting to finish the current flow.