React native integration into existing projects (non-cocoa pods)

Source: Internet
Author: User

  • When adding react native support to an existing iOS project, there are several key steps:

    • Create a new group in the project, and then node_modules Locate React and Libraries two folders below to introduce the. xcodeproj file under the two folders into the group we created.

    • Locate the project build settings configuration, Header Search Paths Add an address below, navigate to the node_modules/react-native/React directory, and select recursive ( recursive ).

    • Find the configuration of the project build phases , locate Link Binary With Libraries it, and complete the configuration by introducing the. A file in step 1.

    • Find the item's Other Linker Flags configuration, add -ObjC and -lc++ flag ?

  • In the introduction of Rctrootview, the official website of the code is a missing parameter, that is, the initialproperties parameter, we have to add this parameter in their own code, pass nil can be.

  • Fill in the module name inside the modulename, register the corresponding module name in JS

    • React native built-in API is not enough to meet all the requirements, and sometimes will write some of their own interface for JS call, the following list some points to note:

    • Because OC is multi-threaded (GCD), the above also said that when executing JavaScript is in the JavaScript thread, so when writing the interface, if you need to invoke the logic of non-JavaScript thread, you need to do in the main thread, That is, getting to the main thread before the business code is:

Dispatch_async (Dispatch_get_main_queue (), ^ {            [nav pushviewcontroller:cg animated:yes];    });

4 in the custom interface, we defined in the OC end of the method, if there are parameters, then the JS end must pass this parameter, if not defined parameters, JS can not pass parameters, this May and JS past syntax is not the same, even if the definition of a method, I preach no error, but in OC is not, Must be passed in strict accordance with the format in which the method is defined.

React native integration into existing projects (non-cocoa pods)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.