Skip to content

Commit

Permalink
wip ios navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomoima525 committed Dec 19, 2017
1 parent 11af591 commit b585ae7
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 18 deletions.
2 changes: 2 additions & 0 deletions ios2/chuckNorrisViewer2/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ target 'chuckNorrisViewer2' do
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTLinkingIOS',
'RCTImage',
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
Expand Down
9 changes: 8 additions & 1 deletion ios2/chuckNorrisViewer2/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ PODS:
- React/PrivateDatabase (0.51.0)
- React/RCTBlob (0.51.0):
- React/Core
- React/RCTImage (0.51.0):
- React/Core
- React/RCTNetwork
- React/RCTLinkingIOS (0.51.0):
- React/Core
- React/RCTNetwork (0.51.0):
- React/Core
- React/RCTText (0.51.0):
Expand All @@ -57,6 +62,8 @@ DEPENDENCIES:
- React/Core (from `../../node_modules/react-native`)
- React/CxxBridge (from `../../node_modules/react-native`)
- React/DevSupport (from `../../node_modules/react-native`)
- React/RCTImage (from `../../node_modules/react-native`)
- React/RCTLinkingIOS (from `../../node_modules/react-native`)
- React/RCTNetwork (from `../../node_modules/react-native`)
- React/RCTText (from `../../node_modules/react-native`)
- React/RCTWebSocket (from `../../node_modules/react-native`)
Expand All @@ -82,6 +89,6 @@ SPEC CHECKSUMS:
React: 352f02f1db6e4744f9a758527e13e3fdefbbd6ba
yoga: b5d96400ca8b2936965a7a6516da7c1177f432a3

PODFILE CHECKSUM: 24340d06fb16b497fb42c18dbaa127a5cce18b22
PODFILE CHECKSUM: 644e41234f966ac3acffeb53fd730da100edd152

COCOAPODS: 1.2.1
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
F393C9161FE83E7600EB0CC0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F393C9151FE83E7600EB0CC0 /* Assets.xcassets */; };
F393C9191FE83E7600EB0CC0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F393C9171FE83E7600EB0CC0 /* LaunchScreen.storyboard */; };
F393C9211FE8811E00EB0CC0 /* MyReactViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F393C9201FE8811E00EB0CC0 /* MyReactViewController.swift */; };
F393C9251FE8A36100EB0CC0 /* ReactEventHook.m in Sources */ = {isa = PBXBuildFile; fileRef = F393C9241FE8A36100EB0CC0 /* ReactEventHook.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -28,6 +29,9 @@
F393C9181FE83E7600EB0CC0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
F393C91A1FE83E7600EB0CC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F393C9201FE8811E00EB0CC0 /* MyReactViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyReactViewController.swift; sourceTree = "<group>"; };
F393C9221FE8A30F00EB0CC0 /* ReactEventHook.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReactEventHook.h; sourceTree = "<group>"; };
F393C9231FE8A36000EB0CC0 /* chuckNorrisViewer2-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "chuckNorrisViewer2-Bridging-Header.h"; sourceTree = "<group>"; };
F393C9241FE8A36100EB0CC0 /* ReactEventHook.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReactEventHook.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -87,6 +91,9 @@
F393C9171FE83E7600EB0CC0 /* LaunchScreen.storyboard */,
F393C91A1FE83E7600EB0CC0 /* Info.plist */,
F393C9201FE8811E00EB0CC0 /* MyReactViewController.swift */,
F393C9221FE8A30F00EB0CC0 /* ReactEventHook.h */,
F393C9241FE8A36100EB0CC0 /* ReactEventHook.m */,
F393C9231FE8A36000EB0CC0 /* chuckNorrisViewer2-Bridging-Header.h */,
);
path = chuckNorrisViewer2;
sourceTree = "<group>";
Expand Down Expand Up @@ -126,6 +133,7 @@
TargetAttributes = {
F393C90A1FE83E7600EB0CC0 = {
CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 0920;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -215,6 +223,7 @@
buildActionMask = 2147483647;
files = (
F393C9111FE83E7600EB0CC0 /* ViewController.swift in Sources */,
F393C9251FE8A36100EB0CC0 /* ReactEventHook.m in Sources */,
F393C90F1FE83E7600EB0CC0 /* AppDelegate.swift in Sources */,
F393C9211FE8811E00EB0CC0 /* MyReactViewController.swift in Sources */,
);
Expand Down Expand Up @@ -354,11 +363,14 @@
baseConfigurationReference = 19A0D48AA1EF43965A659DA8 /* Pods-chuckNorrisViewer2.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = chuckNorrisViewer2/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.tomoima.chuckNorrisViewer2;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "chuckNorrisViewer2/chuckNorrisViewer2-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -369,11 +381,13 @@
baseConfigurationReference = 3E5A0526109D46744E967341 /* Pods-chuckNorrisViewer2.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = chuckNorrisViewer2/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.tomoima.chuckNorrisViewer2;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "chuckNorrisViewer2/chuckNorrisViewer2-Bridging-Header.h";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,20 @@
<action selector="openReact:" destination="BYZ-38-t0r" eventType="touchUpInside" id="dJ1-rL-VW1"/>
</connections>
</button>
<navigationBar contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="teH-8L-Iib">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<items>
<navigationItem title="React Home" id="ECx-Lg-1kc"/>
</items>
</navigationBar>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="edC-z7-GXm" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="33" id="8Fp-ni-zC1"/>
<constraint firstAttribute="trailing" secondItem="teH-8L-Iib" secondAttribute="trailing" id="NVX-u8-Inl"/>
<constraint firstItem="edC-z7-GXm" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="30" id="WHo-8z-Ql6"/>
<constraint firstItem="teH-8L-Iib" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="den-GF-dgF"/>
<constraint firstItem="teH-8L-Iib" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="e7i-th-13U"/>
</constraints>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
Expand All @@ -44,15 +53,6 @@
<view key="view" contentMode="scaleToFill" id="a8g-LG-f8s" customClass="MyReact">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="test" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kgm-7G-oZu">
<rect key="frame" x="173" y="357" width="30" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<viewLayoutGuide key="safeArea" id="bko-cW-D6z"/>
</view>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ import UIKit
import React

class MyReactViewController : UIViewController {
override func viewDidLoad() {
super.viewDidLoad()


override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let jsCodeLocation = URL(string: "https://localhost:8081/index.bundle?platform=ios")

let rootView = RCTRootView(
let reactView: UIView
reactView = RCTRootView(
bundleURL: jsCodeLocation,
moduleName: "ChuckNorrisViewer",
initialProperties: nil,
launchOptions: nil
)
let vc = UIViewController()
vc.view = rootView
self.present(vc, animated: true, completion: nil)
reactView.frame = view.bounds
reactView.translatesAutoresizingMaskIntoConstraints = true
reactView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(reactView)
}
}
14 changes: 14 additions & 0 deletions ios2/chuckNorrisViewer2/chuckNorrisViewer2/ReactEventHook.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ReactEventHook.h
// chuckNorrisViewer2
//
// Created by Tomoaki Imai on 2017/12/18.
// Copyright © 2017 Tomoaki Imai. All rights reserved.
//

#import "React/RCTBridgeModule.h"

@interface ReactEventHook : NSObject <RCTBridgeModule>

@end

20 changes: 20 additions & 0 deletions ios2/chuckNorrisViewer2/chuckNorrisViewer2/ReactEventHook.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// ReactEventHook.m
// chuckNorrisViewer2
//
// Created by Tomoaki Imai on 2017/12/18.
// Copyright © 2017 Tomoaki Imai. All rights reserved.
//

#import "ReactEventHook.h"
#import <React/RCTLog.h>

@implementation ReactEventHook

RCT_EXPORT_MODULE(EventHook)

RCT_EXPORT_METHOD(sendEvent:(NSString *)name data:(nullable NSDictionary *)data)
{
RCTLogInfo(@"Pretending to create an event %@ at %@", name, data);
}
@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

0 comments on commit b585ae7

Please sign in to comment.