Skip to content

Instantly share code, notes, and snippets.

var route: String?
// in viewDidLoad
self.reactViewWrapper.data = [
“route”: self.route!,
“content”: “Welcome to React Native”
]
// ReactNativeObjCViewController.h
@property (strong, nonatomic) NSString *route;
// ReactNativeObjCViewController.m
self.reactViewWrapper.data = [@{
@"route": self.route,
- (IBAction)reactViewObjCPressed:(id)sender {
ReactNativeObjCViewController *reactNativeVC = [self.storyboard instantiateViewControllerWithIdentifier:@"ReactNativeObjCVC"];
reactNativeVC.route = @"routeNameObjectiveCView";
[self.navigationController pushViewController:reactNativeVC animated:YES];
}
- (IBAction)reactViewSwiftPressed:(id)sender {
ReactNativeSwiftViewController *reactNativeVC = [self.storyboard instantiateViewControllerWithIdentifier:@"ReactNativeSwiftVC"];
reactNativeVC.route = @"routeNameSwiftView";
[self.navigationController pushViewController:reactNativeVC animated:YES];
// ReactNativeObjCViewController.h
@property (strong, nonatomic) NSString *route;
'use strict';
import React from 'react-native';
// Views
import SwiftView from './Views/SwiftView';
import ObjectiveCView from './Views/ObjectiveCView';
const {
AppRegistry,
'use strict';
import React from 'react-native';
const {
AppRegistry,
StyleSheet,
Text,
View
} = React;
//
// ReactNativeSwiftViewController.swift
//
import UIKit
class ReactNativeSwiftViewController: UIViewController {
@IBOutlet weak var reactViewWrapper: ReactNativeViewSwift!
//
// ReactNativeObjCViewController.m
//
#import "ReactNativeObjCViewController.h"
#import "ReactNativeViewObjC.h"
@interface ReactNativeObjCViewController ()
@property (weak, nonatomic) IBOutlet ReactNativeViewObjC *reactViewWrapper;
//
// ReactNativeObjCViewController.h
//
#import <UIKit/UIKit.h>
@interface ReactNativeObjCViewController : UIViewController
@end
//
// ReactNativeViewSwift.swift
//
import UIKit
class ReactNativeViewSwift: UIView {
var data: [String: AnyObject]?