diff --git a/docs/next/communication-ios.html b/docs/next/communication-ios.html index da3d1f655c4..fde2cf4e2a6 100644 --- a/docs/next/communication-ios.html +++ b/docs/next/communication-ios.html @@ -133,7 +133,7 @@ rootView.appProperties = @{@"images" : imageLis

Native modules are Objective-C classes that are available in JS. Typically one instance of each module is created per JS bridge. They can export arbitrary functions and constants to React Native. They have been covered in detail in this article.

The fact that native modules are singletons limits the mechanism in the context of embedding. Let's say we have a React Native component embedded in a native view and we want to update the native, parent view. Using the native module mechanism, we would export a function that not only takes expected arguments, but also an identifier of the parent native view. The identifier would be used to retrieve a reference to the parent view to update. That said, we would need to keep a mapping from identifiers to native views in the module.

Although this solution is complex, it is used in RCTUIManager, which is an internal React Native class that manages all React Native views.

-

Native modules can also be used to expose existing native libraries to JS. The Geolocation library is a living example of the idea.

+

Native modules can also be used to expose existing native libraries to JS. The Geolocation library is a living example of the idea.

Warning: All native modules share the same namespace. Watch out for name collisions when creating new ones.

diff --git a/docs/next/communication-ios/index.html b/docs/next/communication-ios/index.html index da3d1f655c4..fde2cf4e2a6 100644 --- a/docs/next/communication-ios/index.html +++ b/docs/next/communication-ios/index.html @@ -133,7 +133,7 @@ rootView.appProperties = @{@"images" : imageLis

Native modules are Objective-C classes that are available in JS. Typically one instance of each module is created per JS bridge. They can export arbitrary functions and constants to React Native. They have been covered in detail in this article.

The fact that native modules are singletons limits the mechanism in the context of embedding. Let's say we have a React Native component embedded in a native view and we want to update the native, parent view. Using the native module mechanism, we would export a function that not only takes expected arguments, but also an identifier of the parent native view. The identifier would be used to retrieve a reference to the parent view to update. That said, we would need to keep a mapping from identifiers to native views in the module.

Although this solution is complex, it is used in RCTUIManager, which is an internal React Native class that manages all React Native views.

-

Native modules can also be used to expose existing native libraries to JS. The Geolocation library is a living example of the idea.

+

Native modules can also be used to expose existing native libraries to JS. The Geolocation library is a living example of the idea.

Warning: All native modules share the same namespace. Watch out for name collisions when creating new ones.