├── .gitignore ├── .watchmanconfig ├── LICENSE ├── README.md ├── android ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── reactlibrary │ ├── RNSimpleCompassModule.java │ └── RNSimpleCompassPackage.java ├── index.js ├── ios ├── RNSimpleCompass.h ├── RNSimpleCompass.m └── RNSimpleCompass.xcodeproj │ └── project.pbxproj └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | ios/RNSimpleCompass.xcodeproj/project.xcworkspace/ 2 | ios/RNSimpleCompass.xcodeproj/xcuserdata/ 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": [ 3 | ".git", 4 | "node_modules" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Viktor Nilsson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # react-native-simple-compass 3 | 4 | ## Getting started 5 | 6 | `$ npm install react-native-simple-compass --save` 7 | 8 | ### Mostly automatic installation 9 | 10 | `$ react-native link react-native-simple-compass` 11 | 12 | ### Manual installation 13 | 14 | 15 | #### iOS 16 | 17 | 1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]` 18 | 2. Go to `node_modules` ➜ `react-native-simple-compass` and add `RNSimpleCompass.xcodeproj` 19 | 3. In XCode, in the project navigator, select your project. Add `libRNSimpleCompass.a` to your project's `Build Phases` ➜ `Link Binary With Libraries` 20 | 4. Run your project (`Cmd+R`)< 21 | 22 | #### Android 23 | 24 | 1. Open up `android/app/src/main/java/[...]/MainActivity.java` 25 | - Add `import com.reactlibrary.RNSimpleCompassPackage;` to the imports at the top of the file 26 | - Add `new RNSimpleCompassPackage()` to the list returned by the `getPackages()` method 27 | 2. Append the following lines to `android/settings.gradle`: 28 | ``` 29 | include ':react-native-simple-compass' 30 | project(':react-native-simple-compass').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-simple-compass/android') 31 | ``` 32 | 3. Insert the following lines inside the dependencies block in `android/app/build.gradle`: 33 | ``` 34 | compile project(':react-native-simple-compass') 35 | ``` 36 | 37 | 38 | ## Usage 39 | ```javascript 40 | import RNSimpleCompass from 'react-native-simple-compass'; 41 | 42 | const degree_update_rate = 3; // Number of degrees changed before the callback is triggered 43 | RNSimpleCompass.start(degree_update_rate, (degree) => { 44 | console.log('You are facing', degree); 45 | RNSimpleCompass.stop(); 46 | }); 47 | ``` 48 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | 2 | apply plugin: 'com.android.library' 3 | 4 | android { 5 | compileSdkVersion 23 6 | buildToolsVersion "23.0.1" 7 | 8 | defaultConfig { 9 | minSdkVersion 16 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | ndk { 14 | abiFilters "armeabi-v7a", "x86" 15 | } 16 | } 17 | lintOptions { 18 | warning 'InvalidPackage' 19 | } 20 | } 21 | 22 | dependencies { 23 | compile 'com.facebook.react:react-native:0.20.+' 24 | } 25 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /android/src/main/java/com/reactlibrary/RNSimpleCompassModule.java: -------------------------------------------------------------------------------- 1 | 2 | package com.reactlibrary; 3 | 4 | import android.hardware.Sensor; 5 | import android.hardware.SensorEvent; 6 | import android.hardware.SensorEventListener; 7 | import android.hardware.SensorManager; 8 | 9 | import android.content.Context; 10 | import com.facebook.react.modules.core.DeviceEventManagerModule; 11 | import com.facebook.react.bridge.Arguments; 12 | 13 | import com.facebook.react.bridge.ReactApplicationContext; 14 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 15 | import com.facebook.react.bridge.ReactMethod; 16 | import com.facebook.react.bridge.Callback; 17 | 18 | public class RNSimpleCompassModule extends ReactContextBaseJavaModule implements SensorEventListener { 19 | 20 | private final ReactApplicationContext reactContext; 21 | 22 | private static Context mApplicationContext; 23 | private int mAzimuth = 0; // degree 24 | private int mFilter = 1; 25 | private SensorManager mSensorManager; 26 | private Sensor mSensor; 27 | private float[] orientation = new float[3]; 28 | private float[] rMat = new float[9]; 29 | 30 | public RNSimpleCompassModule(ReactApplicationContext reactContext) { 31 | super(reactContext); 32 | this.reactContext = reactContext; 33 | mApplicationContext = reactContext.getApplicationContext(); 34 | } 35 | 36 | @Override 37 | public String getName() { 38 | return "RNSimpleCompass"; 39 | } 40 | 41 | @ReactMethod 42 | public void start(int filter) { 43 | 44 | if (mSensorManager == null) { 45 | mSensorManager = (SensorManager) mApplicationContext.getSystemService(Context.SENSOR_SERVICE); 46 | } 47 | 48 | if (mSensor == null) { 49 | mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR); 50 | } 51 | 52 | mFilter = filter; 53 | mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_UI); 54 | } 55 | 56 | @ReactMethod 57 | public void stop() { 58 | if (mSensorManager != null) { 59 | mSensorManager.unregisterListener(this); 60 | } 61 | } 62 | 63 | @Override 64 | public void onSensorChanged(SensorEvent event) { 65 | if( event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR ){ 66 | // calculate th rotation matrix 67 | SensorManager.getRotationMatrixFromVector(rMat, event.values); 68 | // get the azimuth value (orientation[0]) in degree 69 | int newAzimuth = (int) ( Math.toDegrees( SensorManager.getOrientation( rMat, orientation )[0] ) + 360 ) % 360; 70 | 71 | //dont react to changes smaller than the filter value 72 | if (Math.abs(mAzimuth - newAzimuth) < mFilter) { 73 | return; 74 | } 75 | 76 | mAzimuth = newAzimuth; 77 | 78 | getReactApplicationContext() 79 | .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) 80 | .emit("HeadingUpdated", mAzimuth); 81 | } 82 | } 83 | 84 | 85 | @Override 86 | public void onAccuracyChanged(Sensor sensor, int accuracy) { 87 | 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /android/src/main/java/com/reactlibrary/RNSimpleCompassPackage.java: -------------------------------------------------------------------------------- 1 | 2 | package com.reactlibrary; 3 | 4 | import java.util.Arrays; 5 | import java.util.Collections; 6 | import java.util.List; 7 | 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.bridge.NativeModule; 10 | import com.facebook.react.bridge.ReactApplicationContext; 11 | import com.facebook.react.uimanager.ViewManager; 12 | import com.facebook.react.bridge.JavaScriptModule; 13 | public class RNSimpleCompassPackage implements ReactPackage { 14 | @Override 15 | public List createNativeModules(ReactApplicationContext reactContext) { 16 | return Arrays.asList(new RNSimpleCompassModule(reactContext)); 17 | } 18 | 19 | @Override 20 | public List> createJSModules() { 21 | return Collections.emptyList(); 22 | } 23 | 24 | @Override 25 | public List createViewManagers(ReactApplicationContext reactContext) { 26 | return Collections.emptyList(); 27 | } 28 | } -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 2 | import { NativeModules, NativeEventEmitter } from 'react-native'; 3 | const { RNSimpleCompass } = NativeModules; 4 | 5 | let listener; 6 | 7 | //Monkey patching 8 | let _start = RNSimpleCompass.start; 9 | RNSimpleCompass.start = (update_rate, callback) => { 10 | if (listener) { 11 | RNSimpleCompass.stop(); 12 | } 13 | 14 | const compassEventEmitter = new NativeEventEmitter(RNSimpleCompass); 15 | listener = compassEventEmitter.addListener('HeadingUpdated', (degree) => { 16 | callback(degree); 17 | }); 18 | 19 | _start(update_rate === null ? 0 : update_rate); 20 | } 21 | 22 | let _stop = RNSimpleCompass.stop; 23 | RNSimpleCompass.stop = () => { 24 | listener && listener.remove(); 25 | listener = null; 26 | _stop(); 27 | } 28 | 29 | export default RNSimpleCompass; 30 | -------------------------------------------------------------------------------- /ios/RNSimpleCompass.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | 5 | @interface RNSimpleCompass : RCTEventEmitter 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /ios/RNSimpleCompass.m: -------------------------------------------------------------------------------- 1 | #import "RNSimpleCompass.h" 2 | #import 3 | #import 4 | 5 | #define kHeadingUpdated @"HeadingUpdated" 6 | 7 | @interface RNSimpleCompass() 8 | @property (strong, nonatomic) CLLocationManager *locationManager; 9 | @end 10 | 11 | @implementation RNSimpleCompass 12 | 13 | - (instancetype)init { 14 | if (self = [super init]) { 15 | if ([CLLocationManager headingAvailable]) { 16 | self.locationManager = [[CLLocationManager alloc] init]; 17 | self.locationManager.delegate = self; 18 | if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined) { 19 | NSLog(@"Requesting permission"); 20 | [self.locationManager requestWhenInUseAuthorization]; 21 | } 22 | } 23 | else { 24 | NSLog(@"Heading not available"); 25 | } 26 | } 27 | 28 | return self; 29 | } 30 | 31 | #pragma mark - RCTEventEmitter 32 | 33 | - (NSArray *)supportedEvents { 34 | return @[kHeadingUpdated]; 35 | } 36 | 37 | #pragma mark - CLLocationManagerDelegate 38 | 39 | - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading { 40 | if (newHeading.headingAccuracy < 0) { 41 | return; 42 | } 43 | [self sendEventWithName:kHeadingUpdated body:@(newHeading.trueHeading)]; 44 | } 45 | 46 | - (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status { 47 | NSLog(@"AuthoriationStatus changed: %i", status); 48 | } 49 | 50 | - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { 51 | NSLog(@"Location manager failed: %@", error); 52 | } 53 | 54 | - (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager 55 | { 56 | CLLocationDirection accuracy = [[manager heading] headingAccuracy]; 57 | return accuracy <= 0.0f || accuracy > 10.0f; 58 | } 59 | 60 | #pragma mark - React 61 | 62 | RCT_EXPORT_METHOD(start: (NSInteger) headingFilter) { 63 | self.locationManager.headingFilter = headingFilter; 64 | [self.locationManager startUpdatingHeading]; 65 | } 66 | 67 | RCT_EXPORT_METHOD(stop) { 68 | [self.locationManager stopUpdatingHeading]; 69 | } 70 | 71 | RCT_EXPORT_MODULE() 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /ios/RNSimpleCompass.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B3E7B58A1CC2AC0600A0062D /* RNSimpleCompass.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNSimpleCompass.m */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXCopyFilesBuildPhase section */ 14 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 15 | isa = PBXCopyFilesBuildPhase; 16 | buildActionMask = 2147483647; 17 | dstPath = "include/$(PRODUCT_NAME)"; 18 | dstSubfolderSpec = 16; 19 | files = ( 20 | ); 21 | runOnlyForDeploymentPostprocessing = 0; 22 | }; 23 | /* End PBXCopyFilesBuildPhase section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 134814201AA4EA6300B7C361 /* libRNSimpleCompass.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNSimpleCompass.a; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | B3E7B5881CC2AC0600A0062D /* RNSimpleCompass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSimpleCompass.h; sourceTree = ""; }; 28 | B3E7B5891CC2AC0600A0062D /* RNSimpleCompass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSimpleCompass.m; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 134814211AA4EA7D00B7C361 /* Products */ = { 43 | isa = PBXGroup; 44 | children = ( 45 | 134814201AA4EA6300B7C361 /* libRNSimpleCompass.a */, 46 | ); 47 | name = Products; 48 | sourceTree = ""; 49 | }; 50 | 58B511D21A9E6C8500147676 = { 51 | isa = PBXGroup; 52 | children = ( 53 | B3E7B5881CC2AC0600A0062D /* RNSimpleCompass.h */, 54 | B3E7B5891CC2AC0600A0062D /* RNSimpleCompass.m */, 55 | 134814211AA4EA7D00B7C361 /* Products */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | /* End PBXGroup section */ 60 | 61 | /* Begin PBXNativeTarget section */ 62 | 58B511DA1A9E6C8500147676 /* RNSimpleCompass */ = { 63 | isa = PBXNativeTarget; 64 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNSimpleCompass" */; 65 | buildPhases = ( 66 | 58B511D71A9E6C8500147676 /* Sources */, 67 | 58B511D81A9E6C8500147676 /* Frameworks */, 68 | 58B511D91A9E6C8500147676 /* CopyFiles */, 69 | ); 70 | buildRules = ( 71 | ); 72 | dependencies = ( 73 | ); 74 | name = RNSimpleCompass; 75 | productName = RCTDataManager; 76 | productReference = 134814201AA4EA6300B7C361 /* libRNSimpleCompass.a */; 77 | productType = "com.apple.product-type.library.static"; 78 | }; 79 | /* End PBXNativeTarget section */ 80 | 81 | /* Begin PBXProject section */ 82 | 58B511D31A9E6C8500147676 /* Project object */ = { 83 | isa = PBXProject; 84 | attributes = { 85 | LastUpgradeCheck = 0800; 86 | ORGANIZATIONNAME = Facebook; 87 | TargetAttributes = { 88 | 58B511DA1A9E6C8500147676 = { 89 | CreatedOnToolsVersion = 6.1.1; 90 | }; 91 | }; 92 | }; 93 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNSimpleCompass" */; 94 | compatibilityVersion = "Xcode 3.2"; 95 | developmentRegion = English; 96 | hasScannedForEncodings = 0; 97 | knownRegions = ( 98 | en, 99 | ); 100 | mainGroup = 58B511D21A9E6C8500147676; 101 | productRefGroup = 58B511D21A9E6C8500147676; 102 | projectDirPath = ""; 103 | projectRoot = ""; 104 | targets = ( 105 | 58B511DA1A9E6C8500147676 /* RNSimpleCompass */, 106 | ); 107 | }; 108 | /* End PBXProject section */ 109 | 110 | /* Begin PBXSourcesBuildPhase section */ 111 | 58B511D71A9E6C8500147676 /* Sources */ = { 112 | isa = PBXSourcesBuildPhase; 113 | buildActionMask = 2147483647; 114 | files = ( 115 | B3E7B58A1CC2AC0600A0062D /* RNSimpleCompass.m in Sources */, 116 | ); 117 | runOnlyForDeploymentPostprocessing = 0; 118 | }; 119 | /* End PBXSourcesBuildPhase section */ 120 | 121 | /* Begin XCBuildConfiguration section */ 122 | 58B511ED1A9E6C8500147676 /* Debug */ = { 123 | isa = XCBuildConfiguration; 124 | buildSettings = { 125 | ALWAYS_SEARCH_USER_PATHS = NO; 126 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 127 | CLANG_CXX_LIBRARY = "libc++"; 128 | CLANG_ENABLE_MODULES = YES; 129 | CLANG_ENABLE_OBJC_ARC = YES; 130 | CLANG_WARN_BOOL_CONVERSION = YES; 131 | CLANG_WARN_CONSTANT_CONVERSION = YES; 132 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 133 | CLANG_WARN_EMPTY_BODY = YES; 134 | CLANG_WARN_ENUM_CONVERSION = YES; 135 | CLANG_WARN_INFINITE_RECURSION = YES; 136 | CLANG_WARN_INT_CONVERSION = YES; 137 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 138 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 139 | CLANG_WARN_UNREACHABLE_CODE = YES; 140 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 141 | COPY_PHASE_STRIP = NO; 142 | ENABLE_STRICT_OBJC_MSGSEND = YES; 143 | ENABLE_TESTABILITY = YES; 144 | GCC_C_LANGUAGE_STANDARD = gnu99; 145 | GCC_DYNAMIC_NO_PIC = NO; 146 | GCC_NO_COMMON_BLOCKS = YES; 147 | GCC_OPTIMIZATION_LEVEL = 0; 148 | GCC_PREPROCESSOR_DEFINITIONS = ( 149 | "DEBUG=1", 150 | "$(inherited)", 151 | ); 152 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 153 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 154 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 155 | GCC_WARN_UNDECLARED_SELECTOR = YES; 156 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 157 | GCC_WARN_UNUSED_FUNCTION = YES; 158 | GCC_WARN_UNUSED_VARIABLE = YES; 159 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 160 | MTL_ENABLE_DEBUG_INFO = YES; 161 | ONLY_ACTIVE_ARCH = YES; 162 | SDKROOT = iphoneos; 163 | }; 164 | name = Debug; 165 | }; 166 | 58B511EE1A9E6C8500147676 /* Release */ = { 167 | isa = XCBuildConfiguration; 168 | buildSettings = { 169 | ALWAYS_SEARCH_USER_PATHS = NO; 170 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 171 | CLANG_CXX_LIBRARY = "libc++"; 172 | CLANG_ENABLE_MODULES = YES; 173 | CLANG_ENABLE_OBJC_ARC = YES; 174 | CLANG_WARN_BOOL_CONVERSION = YES; 175 | CLANG_WARN_CONSTANT_CONVERSION = YES; 176 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 177 | CLANG_WARN_EMPTY_BODY = YES; 178 | CLANG_WARN_ENUM_CONVERSION = YES; 179 | CLANG_WARN_INFINITE_RECURSION = YES; 180 | CLANG_WARN_INT_CONVERSION = YES; 181 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 182 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 183 | CLANG_WARN_UNREACHABLE_CODE = YES; 184 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 185 | COPY_PHASE_STRIP = YES; 186 | ENABLE_NS_ASSERTIONS = NO; 187 | ENABLE_STRICT_OBJC_MSGSEND = YES; 188 | GCC_C_LANGUAGE_STANDARD = gnu99; 189 | GCC_NO_COMMON_BLOCKS = YES; 190 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 191 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 192 | GCC_WARN_UNDECLARED_SELECTOR = YES; 193 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 194 | GCC_WARN_UNUSED_FUNCTION = YES; 195 | GCC_WARN_UNUSED_VARIABLE = YES; 196 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 197 | MTL_ENABLE_DEBUG_INFO = NO; 198 | SDKROOT = iphoneos; 199 | VALIDATE_PRODUCT = YES; 200 | }; 201 | name = Release; 202 | }; 203 | 58B511F01A9E6C8500147676 /* Debug */ = { 204 | isa = XCBuildConfiguration; 205 | buildSettings = { 206 | HEADER_SEARCH_PATHS = ( 207 | "$(inherited)", 208 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 209 | "$(SRCROOT)/../../../React/**", 210 | "$(SRCROOT)/../../react-native/React/**", 211 | ); 212 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 213 | OTHER_LDFLAGS = "-ObjC"; 214 | PRODUCT_NAME = RNSimpleCompass; 215 | SKIP_INSTALL = YES; 216 | }; 217 | name = Debug; 218 | }; 219 | 58B511F11A9E6C8500147676 /* Release */ = { 220 | isa = XCBuildConfiguration; 221 | buildSettings = { 222 | HEADER_SEARCH_PATHS = ( 223 | "$(inherited)", 224 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 225 | "$(SRCROOT)/../../../React/**", 226 | "$(SRCROOT)/../../react-native/React/**", 227 | ); 228 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 229 | OTHER_LDFLAGS = "-ObjC"; 230 | PRODUCT_NAME = RNSimpleCompass; 231 | SKIP_INSTALL = YES; 232 | }; 233 | name = Release; 234 | }; 235 | /* End XCBuildConfiguration section */ 236 | 237 | /* Begin XCConfigurationList section */ 238 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNSimpleCompass" */ = { 239 | isa = XCConfigurationList; 240 | buildConfigurations = ( 241 | 58B511ED1A9E6C8500147676 /* Debug */, 242 | 58B511EE1A9E6C8500147676 /* Release */, 243 | ); 244 | defaultConfigurationIsVisible = 0; 245 | defaultConfigurationName = Release; 246 | }; 247 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNSimpleCompass" */ = { 248 | isa = XCConfigurationList; 249 | buildConfigurations = ( 250 | 58B511F01A9E6C8500147676 /* Debug */, 251 | 58B511F11A9E6C8500147676 /* Release */, 252 | ); 253 | defaultConfigurationIsVisible = 0; 254 | defaultConfigurationName = Release; 255 | }; 256 | /* End XCConfigurationList section */ 257 | }; 258 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 259 | } 260 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-simple-compass", 3 | "version": "1.0.0", 4 | "description": "Simple module exposing the compass on iOS and Android", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [ 10 | "react-native" 11 | ], 12 | "author": "", 13 | "license": "", 14 | "devDependencies": { 15 | "react-native": "*" 16 | } 17 | } 18 | --------------------------------------------------------------------------------