React native RN development example

Multi-entry loading method 

React Native mixed development multi-entry loading method Develop Paper

initialProperties

Official Documentation: React Navigation

moduleName

Example: GitHub - hcn1519/ReactNative-iOS-Example

React Native mixed development multi-entry loading method Develop Paper

project structure 

Reference: GitHub - nam-dohai/freelance-platform-app

common problem

1、过多的注册RN组件( AppRegistry.registerComponent() );
2、从原生跳转指定的RN页面及传值问题;
3、路由处理:原生 -> React Native -> 原生 -> React Native,多次操作后的进栈出栈问题。

Mixed compilation of React Native and native (Android, iOS), analysis of pain points at three terminals - Programmer Sought

ios connect to real machine

add script

../node_modules/react-native/scripts/react-native-xcode.sh

No bundle URL present [fixed]

https://onexlab-io.medium.com/no-bundle-url-present-fixed-ca2688a80f66

question:

RCTStatusBarManager module requires that the UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO

The easiest solution is to follow the prompts, change Info.pllist, and add fields 


<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

After this is set to NO, it will not be called in the viewcontroller

    override var preferredStatusBarStyle: UIStatusBarStyle {
        return .darkContent
    }

The ios of our project is embedded in rn, and other pages still need statusbar, so we need to continue to modify

Project -> Targets -> Status Bar Style by desired color.

solution  

How to set status bar style | Sarunw

xcode10 - preferredStatusBarStyle var not working in iOS12? - Stack Overflow

Pack

React Native packaging IOS ultra-detailed steps

Added in the RN project package

        "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'",

Excuting an order:

yarn build:ios

 

Add to xcode project

 

 

There is a judgment in the ios code, and the sheme can package the local js resources by selecting a non-debug environment. 

    #ifdef DEBUG
      jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
    #else
      jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
    #endif

other references

GitHub - 1280103995/RN-Android-iOS: native Android and iOS mixed with React Native; Android MVP optimized version of the application

Guess you like

Origin blog.csdn.net/linzhiji/article/details/130273048