Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the function of native in the front end of web

2025-04-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

The main content of this article is to explain "what is the role of native in the front end of web". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what is the role of native in the front end of web"?

React-native implements the transfer of values between pages.

Using reactNavigation components

Compatibility: IOS/Android

Principle: reactNavigation mounts the navigation object on the props of the page, which can be used for routing jump. When doing the page jump, you can bring parameters / callback method to the target page, so as to achieve the purpose of passing parameters.

Switching routing method:

This.props.navigation.goBack () returns to the previous level

This.props.navigation.popToTop () returns to the top of the stack

This.props.navigation.push ('Details') continues to push down the new route, which is equivalent to a child page of a child page

This.props.navigation.navigate ('Details') pushes the new route to the navigator, or jumps to the page if it is not in the navigator

The parent page passes parameters to the child page

{

This.props.navigation.navigate ('Bamboo, {

Params:xx

})

}

} >

Subpage receive parameters

Constructor (props) {

Super (props)

Const {navigation} = this.props

Letyy=navigation.getParam ("params")

}

In this way, the page gets the value passed by the parent page.

ReactNative adds Redux support

Now the project environment is as follows:

{

"name": "app"

"version": "0.0.1"

"private": true

"scripts": {

"start": "react-nativestart"

"test": "jest"

"lint": "eslint."

}

"dependencies": {

"native-base": "^ 2.13.4"

"react": "16.8.6"

"react-native": "0.60.5"

"react-native-gesture-handler": "^ 1.3.0"

"react-native-keyboard-aware-scroll-view": "^ 0.9.1"

"react-native-reanimated": "^ 1.2.0"

"react-navigation": "^ 3.11.1"

}

At this point, I believe you have a deeper understanding of "what is the role of native in the front end of web?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 275

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report