Skip to content

Latest commit

 

History

History
101 lines (89 loc) · 7.79 KB

API_CONFIGURATION.md

File metadata and controls

101 lines (89 loc) · 7.79 KB

API and Configuration

Available imports

  • Router
  • Scene
  • Modal
  • TabBar
  • getInitialState
  • Reducer
  • DefaultRenderer
  • Switch
  • Actions
  • NavBar

Router:

Property Type Default Description
reducer function optional user-defined reducer for scenes, you may want to use it to intercept all actions and put your custom logic
createReducer function function that returns a reducer function for {initialState, scenes} param, you may wrap Reducer(param) with your custom reducer, check Flux usage section below
other props all properties that will be passed to all your scenes
children required (if no scenes property passed) Scene root element
scenes object optional scenes for Router created with Actions.create. This will allow to create all actions BEFORE React processing. If you don't need it you may pass Scene root element as children
getSceneStyle function optional Optionally override the styles for NavigationCard's Animated.View rendering the scene.

Scene:

Property Type Default Description
key string required Will be used to call screen transition, for example, Actions.name(params). Must be unique.
component React.Component semi-required The Component to be displayed. Not required when defining a nested Scene, see example. If it is defined for 'container' scene, it will be used as custom container renderer
initial bool false Set to true if this is the initial scene
type string 'push' or 'jump' Defines how the new screen is added to the navigator stack. One of push, jump, replace, reset. If parent container is tabbar (tabs=true), jump will be automatically set.
clone bool Scenes marked with clone will be treated as templates and cloned into the current scene's parent when pushed. See example.

Animation

Property Type Default Description
duration number optional. acts as a shortcut to writing an applyAnimation function with Animated.timing for a given duration (in ms).
direction string 'horizontal' direction of animation horizontal/vertical
applyAnimation function optional if provided overrides the default spring animation

Scene styles

Property Type Default Description
sceneStyle View style { flex: 1 } optional style override for the Scene's component
getSceneStyle function optional Optionally override the styles for NavigationCard's Animated.View rendering the scene.

Tabs

Property Type Default Description
tabs bool false Defines 'TabBar' scene container, so child scenes will be displayed as 'tabs'. If no component is defined, built-in TabBar is used as renderer. All child scenes are wrapped into own navbar.
tabBarStyle View style optional style override for the Tabs component
hideTabBar bool false hides tab bar for this scene (if built-in TabBar component is used as parent renderer)
popChildrenOnSelect bool false Pop all children in the stack to go back to the initial scene for this tab when it is selected again.

Navigation Bar

Property Type Default Description
hideNavBar bool false hides the navigation bar for this scene
navigationBarStyle View style optional style override for the navigation bar
navBar React.Component optional custom NavBar for the scene. Check built-in NavBar of the component for reference
drawerImage Image source './menu_burger.png' Simple way to override the drawerImage in the navBar

Navigation Bar: Title

Property Type Default Description
title string null The title to be displayed in the navigation bar
getTitle function optional Optionally closure to return a value of the title based on state
renderTitle function optional Optionally closure to render the title
titleStyle Text style optional style override for the title element

Navigation Bar: Back button

Property Type Default Description
backTitle string optional string to display with back button
renderBackButton function optional closure to render back text or button if this route happens to be the previous route
backButtonImage Image source './back_chevron.png' Simple way to override the back button in the navBar
backButtonTextStyle Text style optional style override for the back title element

Navigation Bar: Left button

Property Type Default Description
leftTitle string optional string to display on the left if the previous route does not provide renderBackButton prop. renderBackButton > leftTitle > <previous route's title>
renderLeftButton function optional closure to render the left title / buttons element
onLeft function function will be called when left navBar button is pressed
leftButtonImage Image source Image for left button
leftButtonIconStyle View style Image style for left button
leftButtonStyle View style optional style override for the container of left title / buttons
leftButtonTextStyle Text style optional style override for the left title element

Navigation Bar: Right button

Property Type Default Description
rightTitle string optional string to display on the right. onRight must be provided for this to appear.
renderRightButton function optional closure to render the right title / buttons element
onRight function function will be called when right navBar button is pressed
rightButtonImage Image source Image for right button
rightButtonIconStyle View style Image style for right button
rightButtonStyle View style optional style override for the container of right title / buttons
rightButtonTextStyle Text style optional style override for the right title element
...other props all properties that will be passed to your component instance