Permalink
Browse files

Add React Native High Score Screen

  • Loading branch information...
JoelMarcey committed May 24, 2016
1 parent 7c0840a commit 9ae70c7cdd53eb59f5f7c7daab382b0300ed3585
Showing with 242 additions and 10 deletions.
  1. +8 −2 .gitignore
  2. +50 −0 index.ios.js
  3. +85 −0 {NumberTileGame → ios}/NumberTileGame.xcodeproj/project.pbxproj
  4. 0 ...os}/NumberTileGame.xcodeproj/xcuserdata/austinzheng.xcuserdatad/xcschemes/NumberTileGame.xcscheme
  5. 0 ...s}/NumberTileGame.xcodeproj/xcuserdata/austinzheng.xcuserdatad/xcschemes/xcschememanagement.plist
  6. +13 −8 {NumberTileGame → ios}/NumberTileGame/Base.lproj/Main_iPhone.storyboard
  7. 0 {NumberTileGame → ios}/NumberTileGame/F3HAppDelegate.h
  8. 0 {NumberTileGame → ios}/NumberTileGame/F3HAppDelegate.m
  9. 0 {NumberTileGame → ios}/NumberTileGame/F3HNumberTileGameViewController.h
  10. 0 {NumberTileGame → ios}/NumberTileGame/F3HNumberTileGameViewController.m
  11. 0 {NumberTileGame → ios}/NumberTileGame/F3HTileAppearanceProvider.h
  12. 0 {NumberTileGame → ios}/NumberTileGame/F3HTileAppearanceProvider.m
  13. 0 {NumberTileGame → ios}/NumberTileGame/F3HViewController.h
  14. +28 −0 {NumberTileGame → ios}/NumberTileGame/F3HViewController.m
  15. 0 {NumberTileGame → ios}/NumberTileGame/Images.xcassets/AppIcon.appiconset/Contents.json
  16. 0 {NumberTileGame → ios}/NumberTileGame/Images.xcassets/LaunchImage.launchimage/Contents.json
  17. 0 {NumberTileGame → ios}/NumberTileGame/Models/F3HGameModel.h
  18. 0 {NumberTileGame → ios}/NumberTileGame/Models/F3HGameModel.m
  19. 0 {NumberTileGame → ios}/NumberTileGame/Models/F3HMergeTile.h
  20. 0 {NumberTileGame → ios}/NumberTileGame/Models/F3HMergeTile.m
  21. 0 {NumberTileGame → ios}/NumberTileGame/Models/F3HMoveOrder.h
  22. 0 {NumberTileGame → ios}/NumberTileGame/Models/F3HMoveOrder.m
  23. 0 {NumberTileGame → ios}/NumberTileGame/Models/F3HQueueCommand.h
  24. 0 {NumberTileGame → ios}/NumberTileGame/Models/F3HQueueCommand.m
  25. 0 {NumberTileGame → ios}/NumberTileGame/Models/F3HTileModel.h
  26. 0 {NumberTileGame → ios}/NumberTileGame/Models/F3HTileModel.m
  27. +11 −0 {NumberTileGame → ios}/NumberTileGame/NumberTileGame-Info.plist
  28. 0 {NumberTileGame → ios}/NumberTileGame/NumberTileGame-Prefix.pch
  29. 0 {NumberTileGame → ios}/NumberTileGame/Views/F3HControlView.h
  30. 0 {NumberTileGame → ios}/NumberTileGame/Views/F3HControlView.m
  31. 0 {NumberTileGame → ios}/NumberTileGame/Views/F3HGameboardView.h
  32. 0 {NumberTileGame → ios}/NumberTileGame/Views/F3HGameboardView.m
  33. 0 {NumberTileGame → ios}/NumberTileGame/Views/F3HScoreView.h
  34. 0 {NumberTileGame → ios}/NumberTileGame/Views/F3HScoreView.m
  35. 0 {NumberTileGame → ios}/NumberTileGame/Views/F3HTileView.h
  36. 0 {NumberTileGame → ios}/NumberTileGame/Views/F3HTileView.m
  37. 0 {NumberTileGame → ios}/NumberTileGame/en.lproj/InfoPlist.strings
  38. 0 {NumberTileGame → ios}/NumberTileGame/main.m
  39. 0 {NumberTileGame → ios}/NumberTileGameTests/F3HModelTests.m
  40. 0 {NumberTileGame → ios}/NumberTileGameTests/NumberTileGameTests-Info.plist
  41. 0 {NumberTileGame → ios}/NumberTileGameTests/NumberTileGameTests.m
  42. 0 {NumberTileGame → ios}/NumberTileGameTests/en.lproj/InfoPlist.strings
  43. +13 −0 ios/Podfile
  44. +22 −0 ios/Podfile.lock
  45. +12 −0 package.json
View
@@ -1,2 +1,8 @@
NumberTileGame/NumberTileGame.xcodeproj/project.xcworkspace/xcshareddata/NumberTileGame.xccheckout
NumberTileGame/NumberTileGame.xcodeproj/xcuserdata/austinzheng.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
ios/NumberTileGame.xcodeproj/project.xcworkspace/xcshareddata/NumberTileGame.xccheckout
ios/NumberTileGame.xcodeproj/xcuserdata/austinzheng.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
node_modules/
*.xcuserdatad
*.xcworkspace
ios/Pods/
ios/build
npm-debug.log
View
@@ -0,0 +1,50 @@
'use strict';
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
class RNHighScores extends React.Component {
render() {
console.log(this.props["scores"]);
var contents = this.props["scores"].map(
score => <Text key={score.name}>{score.name}:{score.value}{"\n"}</Text>
);
return (
<View style={styles.container}>
<Text style={styles.highScoresTitle}>
2048 High Scores!
</Text>
<Text style={styles.scores}>
{contents}
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#FFFFFF',
},
highScoresTitle: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
scores: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
// Module name
AppRegistry.registerComponent('RNHighScores', () => RNHighScores);
@@ -34,6 +34,7 @@
1A34882518E169AA00D021C3 /* F3HScoreView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A34882418E169AA00D021C3 /* F3HScoreView.m */; };
1A34882818E1713E00D021C3 /* F3HControlView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A34882718E1713E00D021C3 /* F3HControlView.m */; };
1A92D000191A016600E35C6C /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A92CFFF191A016600E35C6C /* QuartzCore.framework */; };
DCDE1A7BBC6CFB0B426A1E07 /* libPods-NumberTileGame.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BEADC7D751875B40D3C10E60 /* libPods-NumberTileGame.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -90,6 +91,9 @@
1A34882618E1713E00D021C3 /* F3HControlView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = F3HControlView.h; path = Views/F3HControlView.h; sourceTree = "<group>"; };
1A34882718E1713E00D021C3 /* F3HControlView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = F3HControlView.m; path = Views/F3HControlView.m; sourceTree = "<group>"; };
1A92CFFF191A016600E35C6C /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
4AD166A2E5FDC4A2D448ACC2 /* Pods-NumberTileGame.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NumberTileGame.debug.xcconfig"; path = "Pods/Target Support Files/Pods-NumberTileGame/Pods-NumberTileGame.debug.xcconfig"; sourceTree = "<group>"; };
60A3B1CD8D807EF28EB8C727 /* Pods-NumberTileGame.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NumberTileGame.release.xcconfig"; path = "Pods/Target Support Files/Pods-NumberTileGame/Pods-NumberTileGame.release.xcconfig"; sourceTree = "<group>"; };
BEADC7D751875B40D3C10E60 /* libPods-NumberTileGame.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-NumberTileGame.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -101,6 +105,7 @@
1A3487B318DEAD6E00D021C3 /* CoreGraphics.framework in Frameworks */,
1A3487B518DEAD6E00D021C3 /* UIKit.framework in Frameworks */,
1A3487B118DEAD6E00D021C3 /* Foundation.framework in Frameworks */,
DCDE1A7BBC6CFB0B426A1E07 /* libPods-NumberTileGame.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -117,13 +122,23 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
18E6C7CBC5C473F8DB0460B2 /* Pods */ = {
isa = PBXGroup;
children = (
4AD166A2E5FDC4A2D448ACC2 /* Pods-NumberTileGame.debug.xcconfig */,
60A3B1CD8D807EF28EB8C727 /* Pods-NumberTileGame.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
1A3487A418DEAD6E00D021C3 = {
isa = PBXGroup;
children = (
1A3487B618DEAD6E00D021C3 /* NumberTileGame */,
1A3487D818DEAD6E00D021C3 /* NumberTileGameTests */,
1A3487AF18DEAD6E00D021C3 /* Frameworks */,
1A3487AE18DEAD6E00D021C3 /* Products */,
18E6C7CBC5C473F8DB0460B2 /* Pods */,
);
sourceTree = "<group>";
};
@@ -144,6 +159,7 @@
1A3487B218DEAD6E00D021C3 /* CoreGraphics.framework */,
1A3487B418DEAD6E00D021C3 /* UIKit.framework */,
1A3487D218DEAD6E00D021C3 /* XCTest.framework */,
BEADC7D751875B40D3C10E60 /* libPods-NumberTileGame.a */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -237,9 +253,12 @@
isa = PBXNativeTarget;
buildConfigurationList = 1A3487E218DEAD6E00D021C3 /* Build configuration list for PBXNativeTarget "NumberTileGame" */;
buildPhases = (
867B69DBFC846779D43D3097 /* 📦 Check Pods Manifest.lock */,
1A3487A918DEAD6E00D021C3 /* Sources */,
1A3487AA18DEAD6E00D021C3 /* Frameworks */,
1A3487AB18DEAD6E00D021C3 /* Resources */,
B86DCC2793799901DE9B7291 /* 📦 Embed Pods Frameworks */,
C97414C48774DC81FB16EC81 /* 📦 Copy Pods Resources */,
);
buildRules = (
);
@@ -325,6 +344,54 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
867B69DBFC846779D43D3097 /* 📦 Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
B86DCC2793799901DE9B7291 /* 📦 Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-NumberTileGame/Pods-NumberTileGame-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
C97414C48774DC81FB16EC81 /* 📦 Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "📦 Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-NumberTileGame/Pods-NumberTileGame-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
1A3487A918DEAD6E00D021C3 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -468,6 +535,7 @@
};
1A3487E318DEAD6E00D021C3 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 4AD166A2E5FDC4A2D448ACC2 /* Pods-NumberTileGame.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
@@ -477,6 +545,14 @@
GCC_PREFIX_HEADER = "NumberTileGame/NumberTileGame-Prefix.pch";
INFOPLIST_FILE = "NumberTileGame/NumberTileGame-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-l\"React\"",
"-framework",
"\"JavaScriptCore\"",
"-lc++",
);
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
@@ -485,6 +561,7 @@
};
1A3487E418DEAD6E00D021C3 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 60A3B1CD8D807EF28EB8C727 /* Pods-NumberTileGame.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
@@ -494,6 +571,14 @@
GCC_PREFIX_HEADER = "NumberTileGame/NumberTileGame-Prefix.pch";
INFOPLIST_FILE = "NumberTileGame/NumberTileGame-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-l\"React\"",
"-framework",
"\"JavaScriptCore\"",
"-lc++",
);
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5053" systemVersion="13C64" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
@@ -18,25 +19,29 @@
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="16F-gs-6Ou">
<rect key="frame" x="79" y="269" width="163" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Play Game">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="playGameButtonTapped:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="PGL-Ig-Pfo"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dzC-4t-AP8">
<rect key="frame" x="79" y="342" width="163" height="30"/>
<state key="normal" title="High Scores">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="highScoreButtonPressed:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="yln-qy-aWL"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-167" y="203"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
@@ -10,6 +10,8 @@
#import "F3HNumberTileGameViewController.h"
#import "RCTRootView.h"
@interface F3HViewController ()
@end
@@ -25,4 +27,30 @@ - (IBAction)playGameButtonTapped:(id)sender {
[self presentViewController:c animated:YES completion:nil];
}
- (IBAction)highScoreButtonPressed:(id)sender {
NSLog(@"High Score Button Pressed");
NSURL *jsCodeLocation = [NSURL
URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios"];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName: @"RNHighScores"
initialProperties:
@{
@"scores": @[
@{
@"name": @"Alex",
@"value": @"42"
},
@{
@"name": @"Joel",
@"value": @"10"
}
]
}
launchOptions:nil
];
UIViewController *vc = [[UIViewController alloc] init];
vc.view = rootView;
[self presentViewController:vc animated:YES completion:nil];
}
@end
@@ -45,5 +45,16 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>
File renamed without changes.
View
@@ -0,0 +1,13 @@
# The target name is most likely the name of your project.
target 'NumberTileGame' do
# Your 'node_modules' directory is probably in the root of your project,
# but if not, adjust the `:path` accordingly
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'RCTText',
'RCTWebSocket', # needed for localhost testing of your app
# Add any other subspecs you want to use in your project
]
end
View
@@ -0,0 +1,22 @@
PODS:
- React/Core (0.26.1)
- React/RCTText (0.26.1):
- React/Core
- React/RCTWebSocket (0.26.1):
- React/Core
DEPENDENCIES:
- React/Core (from `../node_modules/react-native`)
- React/RCTText (from `../node_modules/react-native`)
- React/RCTWebSocket (from `../node_modules/react-native`)
EXTERNAL SOURCES:
React:
:path: ../node_modules/react-native
SPEC CHECKSUMS:
React: 9a7eb5f6e7146734fb50ab17f515087d302d5cca
PODFILE CHECKSUM: b04d58ca963fdaa40e18a7768f60f281967045ca
COCOAPODS: 1.0.0
View
@@ -0,0 +1,12 @@
{
"name": "NumberTileGame",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react": "15.0.2",
"react-native": "0.26.1"
}
}

12 comments on commit 9ae70c7

@chwnFlyPig

This comment has been minimized.

Show comment
Hide comment
@chwnFlyPig

chwnFlyPig Jun 26, 2017

"RCTRootView.h" file not found

chwnFlyPig replied Jun 26, 2017

"RCTRootView.h" file not found

@JoelMarcey

This comment has been minimized.

Show comment
Hide comment
@JoelMarcey

JoelMarcey Jun 26, 2017

Owner

Can you provide a bit more context? Are you trying to run this from the Xcode simulator?

It's been a couple of years since I have done anything with this fork. We might have to file an issue with React Native, not sure yet -- but, that file still does exist in React Native's master. https://github.com/facebook/react-native/blob/master/React/Base/RCTRootView.h

It could be that the dependencies are out of date in the package.json too.

Owner

JoelMarcey replied Jun 26, 2017

Can you provide a bit more context? Are you trying to run this from the Xcode simulator?

It's been a couple of years since I have done anything with this fork. We might have to file an issue with React Native, not sure yet -- but, that file still does exist in React Native's master. https://github.com/facebook/react-native/blob/master/React/Base/RCTRootView.h

It could be that the dependencies are out of date in the package.json too.

@orinmurphy

This comment has been minimized.

Show comment
Hide comment
@orinmurphy

orinmurphy Oct 3, 2017

The documentation uses:
AppRegistry.registerComponent('MyReactNativeApp', () => RNHighScores);

but your code uses:
AppRegistry.registerComponent('RNHighScores', () => RNHighScores);

orinmurphy replied Oct 3, 2017

The documentation uses:
AppRegistry.registerComponent('MyReactNativeApp', () => RNHighScores);

but your code uses:
AppRegistry.registerComponent('RNHighScores', () => RNHighScores);

@JoelMarcey

This comment has been minimized.

Show comment
Hide comment
@JoelMarcey

JoelMarcey Oct 5, 2017

Owner

@orinmurphy Did the code work for you? If so, we can use that as the source of truth. Any interest in sending a PR to fix the docs?

Owner

JoelMarcey replied Oct 5, 2017

@orinmurphy Did the code work for you? If so, we can use that as the source of truth. Any interest in sending a PR to fix the docs?

@dhei

This comment has been minimized.

Show comment
Hide comment
@dhei

dhei Dec 5, 2017

@chwnFlyPig I have seen the same "RCTRootView.h" file not found error. I believed it's caused by namespace-header-imports breaking change in react-native@0.40.0. The #import 'RCTRootView.h' syntax that is not valid after react-native@0.40.0. If you are using a newer version of react native, changing it to #import <React/RCTRootView.h> should work.

cc @JoelMarcey

dhei replied Dec 5, 2017

@chwnFlyPig I have seen the same "RCTRootView.h" file not found error. I believed it's caused by namespace-header-imports breaking change in react-native@0.40.0. The #import 'RCTRootView.h' syntax that is not valid after react-native@0.40.0. If you are using a newer version of react native, changing it to #import <React/RCTRootView.h> should work.

cc @JoelMarcey

@JoelMarcey

This comment has been minimized.

Show comment
Hide comment
@JoelMarcey

JoelMarcey Dec 5, 2017

Owner

Definitely would love a PR to make that fix, if indeed it does work.

Owner

JoelMarcey replied Dec 5, 2017

Definitely would love a PR to make that fix, if indeed it does work.

@dhei

This comment has been minimized.

Show comment
Hide comment
@dhei

dhei Dec 6, 2017

@JoelMarcey I was hoping to use this app to understand how brownfield app would work. Unfortunately I was not able to get it working. This project uses react-native@0.26.x which is too old. I spent hours trying to convert this app to work on react-native@0.50.x but so many things related to xcode project structure has changed from v0.26.x to v0.50.x, I realized it's just easier to create a new ios project using react-native init and then copy over code.

Sadly the React Native integration with existing apps documentation refers to this app but this app not working properly.

dhei replied Dec 6, 2017

@JoelMarcey I was hoping to use this app to understand how brownfield app would work. Unfortunately I was not able to get it working. This project uses react-native@0.26.x which is too old. I spent hours trying to convert this app to work on react-native@0.50.x but so many things related to xcode project structure has changed from v0.26.x to v0.50.x, I realized it's just easier to create a new ios project using react-native init and then copy over code.

Sadly the React Native integration with existing apps documentation refers to this app but this app not working properly.

@JoelMarcey

This comment has been minimized.

Show comment
Hide comment
@JoelMarcey

JoelMarcey Jan 4, 2018

Owner

@dhei When you use react-native init, could you use that infrastructure to copy the code from F3HViewController.m and index.ios.js here into there and then create a PR for this? Would that work?

Owner

JoelMarcey replied Jan 4, 2018

@dhei When you use react-native init, could you use that infrastructure to copy the code from F3HViewController.m and index.ios.js here into there and then create a PR for this? Would that work?

@sandsuma

This comment has been minimized.

Show comment
Hide comment
@sandsuma

sandsuma Feb 8, 2018

@JoelMarcey In documentation you mentioned to create a index.js but in the code it mentioned index.io.js , which one is correct?
After starting the packager when I use the xcode to run the project, i get following linking error,
ld: warning: directory not found for option '-L/Users/IMFLsandhya/Library/Developer/Xcode/DerivedData/FormBasedAuthObjC-ebfygmwtcpfisicgocsnscppykim/Build/Products/Debug-iphonesimulator/DoubleConversion'
ld: warning: directory not found for option '-L/Users/IMFLsandhya/Library/Developer/Xcode/DerivedData/FormBasedAuthObjC-ebfygmwtcpfisicgocsnscppykim/Build/Products/Debug-iphonesimulator/GLog'
ld: warning: directory not found for option '-L/Users/IMFLsandhya/Library/Developer/Xcode/DerivedData/FormBasedAuthObjC-ebfygmwtcpfisicgocsnscppykim/Build/Products/Debug-iphonesimulator/React'
ld: warning: directory not found for option '-L/Users/IMFLsandhya/Library/Developer/Xcode/DerivedData/FormBasedAuthObjC-ebfygmwtcpfisicgocsnscppykim/Build/Products/Debug-iphonesimulator/yoga'
ld: library not found for -lDoubleConversion
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I could successfully follow all the steps before running the app mentioned at https://facebook.github.io/react-native/docs/integration-with-existing-apps.html
I can also see Pods for these files are succesfully installed and see them under Pods folders in filesystem, i see the source and header but not the libraries under Pods. What am I missing here?

sandsuma replied Feb 8, 2018

@JoelMarcey In documentation you mentioned to create a index.js but in the code it mentioned index.io.js , which one is correct?
After starting the packager when I use the xcode to run the project, i get following linking error,
ld: warning: directory not found for option '-L/Users/IMFLsandhya/Library/Developer/Xcode/DerivedData/FormBasedAuthObjC-ebfygmwtcpfisicgocsnscppykim/Build/Products/Debug-iphonesimulator/DoubleConversion'
ld: warning: directory not found for option '-L/Users/IMFLsandhya/Library/Developer/Xcode/DerivedData/FormBasedAuthObjC-ebfygmwtcpfisicgocsnscppykim/Build/Products/Debug-iphonesimulator/GLog'
ld: warning: directory not found for option '-L/Users/IMFLsandhya/Library/Developer/Xcode/DerivedData/FormBasedAuthObjC-ebfygmwtcpfisicgocsnscppykim/Build/Products/Debug-iphonesimulator/React'
ld: warning: directory not found for option '-L/Users/IMFLsandhya/Library/Developer/Xcode/DerivedData/FormBasedAuthObjC-ebfygmwtcpfisicgocsnscppykim/Build/Products/Debug-iphonesimulator/yoga'
ld: library not found for -lDoubleConversion
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I could successfully follow all the steps before running the app mentioned at https://facebook.github.io/react-native/docs/integration-with-existing-apps.html
I can also see Pods for these files are succesfully installed and see them under Pods folders in filesystem, i see the source and header but not the libraries under Pods. What am I missing here?

@JoelMarcey

This comment has been minimized.

Show comment
Hide comment
@JoelMarcey

JoelMarcey Feb 9, 2018

Owner

Hi @sandsuma - The documentation could be wrong. Have you tried this creating an index.io.js file?

Owner

JoelMarcey replied Feb 9, 2018

Hi @sandsuma - The documentation could be wrong. Have you tried this creating an index.io.js file?

@xutopia

This comment has been minimized.

Show comment
Hide comment
@xutopia

xutopia Feb 26, 2018

Hi @JoelMarcey, thank you so much for the code and sample app.

I was wondering if you know how to return to the native application view that triggered the display of the RN screen (ie: pop the RCTRootView *rootView) after displaying the React Native screen?
It seems that once the native application triggers the React Native screen, there is no returning back to the native application view(s).

If you have any good resources on how this might be done, I would greatly appreciate it.
Thanks again for all your help!

UPDATE:
Found a solution to my issue. Turns out that any react native view is simply a modal overlay of the UI View Controller that invoked the react native view.

For anyone else stumbling upon this issue, React-Native: Dismiss/Exit React-Native View back to Native solution should help.

xutopia replied Feb 26, 2018

Hi @JoelMarcey, thank you so much for the code and sample app.

I was wondering if you know how to return to the native application view that triggered the display of the RN screen (ie: pop the RCTRootView *rootView) after displaying the React Native screen?
It seems that once the native application triggers the React Native screen, there is no returning back to the native application view(s).

If you have any good resources on how this might be done, I would greatly appreciate it.
Thanks again for all your help!

UPDATE:
Found a solution to my issue. Turns out that any react native view is simply a modal overlay of the UI View Controller that invoked the react native view.

For anyone else stumbling upon this issue, React-Native: Dismiss/Exit React-Native View back to Native solution should help.

@JoelMarcey

This comment has been minimized.

Show comment
Hide comment
@JoelMarcey

JoelMarcey Feb 28, 2018

Owner

@xutopia Glad you found a solution.

Owner

JoelMarcey replied Feb 28, 2018

@xutopia Glad you found a solution.

Please sign in to comment.