Skip to content

Commit 1abaa2d

Browse files
committed
react-native-location initial commit
0 parents  commit 1abaa2d

File tree

23 files changed

+2216
-0
lines changed

23 files changed

+2216
-0
lines changed

.gitignore

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
### SublimeText ###
2+
*.sublime-workspace
3+
4+
### OSX ###
5+
.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
Icon
9+
10+
# Thumbnails
11+
._*
12+
13+
# Files that might appear on external disk
14+
.Spotlight-V100
15+
.Trashes
16+
17+
### Windows ###
18+
# Windows image file caches
19+
Thumbs.db
20+
ehthumbs.db
21+
22+
# Folder config file
23+
Desktop.ini
24+
25+
# Recycle Bin used on file shares
26+
$RECYCLE.BIN/
27+
28+
# Webstorm
29+
.idea
30+
31+
# App specific
32+
33+
npm-debug.log
34+
node_modules/
35+
.tmp
36+
old
37+
38+
# Binaries
39+
*.ipa
40+
*.zip
41+
42+
# Xcode
43+
build/
44+
*.pbxuser
45+
!default.pbxuser
46+
*.mode1v3
47+
!default.mode1v3
48+
*.mode2v3
49+
!default.mode2v3
50+
*.perspectivev3
51+
!default.perspectivev3
52+
*.xcworkspace
53+
!default.xcworkspace
54+
xcuserdata
55+
profile
56+
*.moved-aside
57+
DerivedData
58+
59+
.idea/
60+
61+
# Pods - for those of you who use CocoaPods
62+
Pods

Examples/BeaconList/.flowconfig

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[ignore]
2+
3+
# We fork some components by platform.
4+
.*/*.web.js
5+
.*/*.android.js
6+
7+
# Some modules have their own node_modules with overlap
8+
.*/node_modules/node-haste/.*
9+
10+
# Ignore react-tools where there are overlaps, but don't ignore anything that
11+
# react-native relies on
12+
.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
13+
.*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js
14+
.*/node_modules/react-tools/src/browser/ui/React.js
15+
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
16+
.*/node_modules/react-tools/src/event/EventPropagators.js
17+
18+
# Ignore jest
19+
.*/react-native/node_modules/jest-cli/.*
20+
21+
[include]
22+
23+
[libs]
24+
node_modules/react-native/Libraries/react-native/react-native-interface.js
25+
26+
[options]
27+
module.system=haste

Examples/BeaconList/BeaconList.xcodeproj/project.pbxproj

+779
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0620"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
18+
BuildableName = "BeaconList.app"
19+
BlueprintName = "BeaconList"
20+
ReferencedContainer = "container:BeaconList.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "YES"
26+
buildForProfiling = "NO"
27+
buildForArchiving = "NO"
28+
buildForAnalyzing = "YES">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
32+
BuildableName = "BeaconListTests.xctest"
33+
BlueprintName = "BeaconListTests"
34+
ReferencedContainer = "container:BeaconList.xcodeproj">
35+
</BuildableReference>
36+
</BuildActionEntry>
37+
</BuildActionEntries>
38+
</BuildAction>
39+
<TestAction
40+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
41+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42+
shouldUseLaunchSchemeArgsEnv = "YES"
43+
buildConfiguration = "Debug">
44+
<Testables>
45+
<TestableReference
46+
skipped = "NO">
47+
<BuildableReference
48+
BuildableIdentifier = "primary"
49+
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
50+
BuildableName = "BeaconListTests.xctest"
51+
BlueprintName = "BeaconListTests"
52+
ReferencedContainer = "container:BeaconList.xcodeproj">
53+
</BuildableReference>
54+
</TestableReference>
55+
</Testables>
56+
<MacroExpansion>
57+
<BuildableReference
58+
BuildableIdentifier = "primary"
59+
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
60+
BuildableName = "BeaconList.app"
61+
BlueprintName = "BeaconList"
62+
ReferencedContainer = "container:BeaconList.xcodeproj">
63+
</BuildableReference>
64+
</MacroExpansion>
65+
</TestAction>
66+
<LaunchAction
67+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
68+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
69+
launchStyle = "0"
70+
useCustomWorkingDirectory = "NO"
71+
buildConfiguration = "Debug"
72+
ignoresPersistentStateOnLaunch = "NO"
73+
debugDocumentVersioning = "YES"
74+
allowLocationSimulation = "YES">
75+
<BuildableProductRunnable
76+
runnableDebuggingMode = "0">
77+
<BuildableReference
78+
BuildableIdentifier = "primary"
79+
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
80+
BuildableName = "BeaconList.app"
81+
BlueprintName = "BeaconList"
82+
ReferencedContainer = "container:BeaconList.xcodeproj">
83+
</BuildableReference>
84+
</BuildableProductRunnable>
85+
<AdditionalOptions>
86+
</AdditionalOptions>
87+
</LaunchAction>
88+
<ProfileAction
89+
shouldUseLaunchSchemeArgsEnv = "YES"
90+
savedToolIdentifier = ""
91+
useCustomWorkingDirectory = "NO"
92+
buildConfiguration = "Release"
93+
debugDocumentVersioning = "YES">
94+
<BuildableProductRunnable
95+
runnableDebuggingMode = "0">
96+
<BuildableReference
97+
BuildableIdentifier = "primary"
98+
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
99+
BuildableName = "BeaconList.app"
100+
BlueprintName = "BeaconList"
101+
ReferencedContainer = "container:BeaconList.xcodeproj">
102+
</BuildableReference>
103+
</BuildableProductRunnable>
104+
</ProfileAction>
105+
<AnalyzeAction
106+
buildConfiguration = "Debug">
107+
</AnalyzeAction>
108+
<ArchiveAction
109+
buildConfiguration = "Release"
110+
revealArchiveInOrganizer = "YES">
111+
</ArchiveAction>
112+
</Scheme>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
#import <UIKit/UIKit.h>
11+
#import <XCTest/XCTest.h>
12+
13+
#import "RCTAssert.h"
14+
#import "RCTRedBox.h"
15+
#import "RCTRootView.h"
16+
17+
#define TIMEOUT_SECONDS 240
18+
#define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
19+
20+
@interface BeaconListTests : XCTestCase
21+
22+
@end
23+
24+
@implementation BeaconListTests
25+
26+
27+
- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
28+
{
29+
if (test(view)) {
30+
return YES;
31+
}
32+
for (UIView *subview in [view subviews]) {
33+
if ([self findSubviewInView:subview matching:test]) {
34+
return YES;
35+
}
36+
}
37+
return NO;
38+
}
39+
40+
- (void)testRendersWelcomeScreen {
41+
UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
42+
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
43+
BOOL foundElement = NO;
44+
NSString *redboxError = nil;
45+
46+
while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
47+
[[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:date];
48+
[[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:date];
49+
50+
redboxError = [[RCTRedBox sharedInstance] currentErrorMessage];
51+
52+
foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
53+
if ([view respondsToSelector:@selector(attributedText)]) {
54+
NSString *text = [(id)view attributedText].string;
55+
if ([text isEqualToString:TEXT_TO_LOOK_FOR]) {
56+
return YES;
57+
}
58+
}
59+
return NO;
60+
}];
61+
}
62+
63+
XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
64+
XCTAssertTrue(foundElement, @"Cound't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
65+
}
66+
67+
68+
@end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>BNDL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>1</string>
23+
</dict>
24+
</plist>

Examples/BeaconList/iOS/AppDelegate.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
#import <UIKit/UIKit.h>
11+
12+
@interface AppDelegate : UIResponder <UIApplicationDelegate>
13+
14+
@property (nonatomic, strong) UIWindow *window;
15+
16+
@end

Examples/BeaconList/iOS/AppDelegate.m

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
#import "AppDelegate.h"
11+
12+
#import "RCTRootView.h"
13+
14+
@implementation AppDelegate
15+
16+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
17+
{
18+
NSURL *jsCodeLocation;
19+
20+
/**
21+
* Loading JavaScript code - uncomment the one you want.
22+
*
23+
* OPTION 1
24+
* Load from development server. Start the server from the repository root:
25+
*
26+
* $ npm start
27+
*
28+
* To run on device, change `localhost` to the IP address of your computer
29+
* (you can get this by typing `ifconfig` into the terminal and selecting the
30+
* `inet` value under `en0:`) and make sure your computer and iOS device are
31+
* on the same Wi-Fi network.
32+
*/
33+
34+
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"];
35+
36+
/**
37+
* OPTION 2
38+
* Load from pre-bundled file on disk. To re-generate the static bundle
39+
* from the root of your project directory, run
40+
*
41+
* $ react-native bundle --minify
42+
*
43+
* see http://facebook.github.io/react-native/docs/runningondevice.html
44+
*/
45+
46+
// jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
47+
48+
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
49+
moduleName:@"BeaconList"
50+
launchOptions:launchOptions];
51+
52+
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
53+
UIViewController *rootViewController = [[UIViewController alloc] init];
54+
rootViewController.view = rootView;
55+
self.window.rootViewController = rootViewController;
56+
[self.window makeKeyAndVisible];
57+
return YES;
58+
}
59+
60+
@end

0 commit comments

Comments
 (0)