Simple usage details of Navigatorios components in React Native




We can use Navigatorios we can implement the application navigation (Route) function, that is, the switching and advancement of the view, and retreat. And there will be a navigation bar (you can hide) above the page.

The Navigatorios component is essentially packaged for uikit navigation. Routing with Navigatorios, actually calling UIKIT’s Navigation.

The Navigatorios component only supports the iOS system. React Native also provides an iOS and Android generic navigation components: Navigator. This will be said later.

2, component’s attribute

(1) BartintColor: Background color
(2) InitialRoute: For initialization routing. Each attribute in its parameter object is as follows:


{Component: function, // loaded view component title: string, // Current view Titpros: Object, / / Passed the data backbuttonicon: image.proptypes.source, // Back button icon backbuttitle: string, // back button title leftbuttonicon: image.proptypes.soruce, // left button icon LeftButtitle: String, // left button title ONLEFTBUTTONPRESS: FUNCTION, / / ​​left sideButtons Click Event Rightbuttonicon: Image.Proptypes.Soruce, // Right button icon RightButtitle: String, // Right button Title OnrightButtonPress: Function, // Right button Click Entry Wrapper: [Object Object] // Package Style}

(3) ItemWrapPerstyle: For each custom style, such as the background color of each page.
 (4) NavigationBarhiddent: Hide the navigation bar when True.  (5) SHADOWHIDEN: Hide shadows when TRUE.  (6) TINTCOLOR: The color of the button on the navigation bar. 
(7) TitletextColor: The color of the font on the navigation bar. (8) TRANSLUCENT: When True, the navigation bar is translucent.
3, Method of Component



When the component view is switched, Navigator will be passed as an attribute object. We can get the Navigator object with this.props.navigator. The main method of this object is as follows:
(1) PUST (ROUTE): Load a new page (view or routing) and route to the page.
(2) POP (): Returns to the previous page.
(3) POPN (N): Returns N pages at once. When n = 1, it is equivalent to the effect of the POP () method.

(4) Replace (route): Replace the current route.

(5) ReplacePrevious (Route): Replaces the view of the previous page and retreats back. (6) RESETTO (Route): Replacing the top routing and fall backpast. (7) POPTOTOP (): Back to the uppermost view.

Second, the use of sample



Navigatorios is the navigation component comes with the React Native, which is its simple application.





Import ProPTypes from ‘prop-type’; import react, {component} from ‘react’; import {NavigatorIOS, Text} from ‘react-native’; import {nextScene} from ‘react-native’; export default class NavigatorIOSApp extends Component {render () {return ();}} class MyScene extends Component {static propTypes = {Title: proptypes.String.IsRequired, Navigator: proptypes.Object.isRequired, }_onforward = () => {this.props.navigator.push ({Component: Nextscene Title: ‘Second Scene’});} Render () {return (
current scene: {this.props.title}

Go to the nextScene


Second scene
      EXPORT DEFAULT CLASS NEXTSCENE EXTENDS Component {render () {Return (  This is the second scene  )}}   
It is the whole content of this article, I hope to help everyone, I hope everyone will support Tumi Clouds.


© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment