uiviewbridge
v1.1.0
Published
This is a component you can use to display a Swift UIView in your React Native app.
Downloads
5
Readme
UIView Bridge
This is a component you can use to display a Swift UIView in your React Native app.
Installation
npm install uiviewbridge
Set up
Before being able to use the component, you need to add the native files to your app so they can be compiled with it.
iOS
- Open your projectname.xcworkspace/ by using the following command from the root of your React Native app:
open ios/projectname.xcworkspace
- Then, go to Build Phases and click on the + sign in Compile Sources.
- In the popup window, click on Add Other...
- Select for the UIViewBridge.swift, UIViewBridgeManager.m and UIViewBridgeManager.swift files of the package in projectname > node_nodules > uiviewbridge > ios and click Open.
- Make sure Create folder references is checked and click on Finish.
The added files should now be on the list in Compile Sources.
Usage
Import the component using the following line:
import UIView from 'uiviewbridge'
Render you UIView in your React Native app:
render() {
return(
<UIView
viewControllerName="nameOfSwiftViewController"
viewControllerAppName="nameOfViewControllersApp"
/>
)
}