Skip to content

Commit 1d2de37

Browse files
committed
fixed example
1 parent 8ceb4f2 commit 1d2de37

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

examples/BeaconsDemo/index.ios.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class BeaconsDemo extends Component {
5656
// check bluetooth state:
5757
bluetoothState: '',
5858

59+
message: '',
60+
5961
beaconsLists: new ListView.DataSource({
6062
rowHasChanged: (r1, r2) => r1 !== r2,
6163
sectionHeaderHasChanged: (s1, s2) => s1 !== s2
@@ -98,7 +100,8 @@ class BeaconsDemo extends Component {
98100
DeviceEventEmitter.addListener(
99101
'beaconsDidRange',
100102
(data) => {
101-
console.log('beaconsDidRange, data: ', data);
103+
this.setState({ message: 'beaconsDidRange event'});
104+
// console.log('beaconsDidRange, data: ', data);
102105
const updatedBeaconsLists = this.updateBeaconList(data.beacons, 'rangingList');
103106
this._beaconsLists = updatedBeaconsLists;
104107
this.setState({ beaconsLists: this.state.beaconsLists.cloneWithRowsAndSections(this._beaconsLists)});
@@ -109,6 +112,7 @@ class BeaconsDemo extends Component {
109112
DeviceEventEmitter.addListener(
110113
'regionDidEnter',
111114
({uuid, identifier}) => {
115+
this.setState({ message: 'regionDidEnter event'});
112116
console.log('regionDidEnter, data: ', {uuid, identifier});
113117
const time = moment().format(TIME_FORMAT);
114118
const updatedBeaconsLists = this.updateBeaconList({uuid, identifier, time}, 'monitorEnterList');
@@ -119,6 +123,7 @@ class BeaconsDemo extends Component {
119123
DeviceEventEmitter.addListener(
120124
'regionDidExit',
121125
({ identifier, uuid, minor, major }) => {
126+
this.setState({ message: 'regionDidExit event'});
122127
console.log('regionDidExit, data: ', {identifier, uuid, minor, major});
123128
const time = moment().format(TIME_FORMAT);
124129
const updatedBeaconsLists = this.updateBeaconList({ identifier, uuid, minor, major, time }, 'monitorExitList');
@@ -160,14 +165,22 @@ class BeaconsDemo extends Component {
160165
}
161166

162167
render() {
163-
const { bluetoothState, beaconsLists } = this.state;
168+
const {
169+
bluetoothState,
170+
beaconsLists,
171+
message
172+
} = this.state;
164173

165174
return (
166175
<View style={styles.container}>
167176
<Text style={styles.btleConnectionStatus}>
168177
Bluetooth connection status: { bluetoothState ? bluetoothState : 'NA' }
169178
</Text>
170179

180+
<Text>
181+
{ message }
182+
</Text>
183+
171184
<View style={styles.justFlex}>
172185
<ListView
173186
dataSource={ beaconsLists }

examples/BeaconsDemo/ios/BeaconsDemo.xcodeproj/project.pbxproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,15 @@
347347
name = "Supporting Files";
348348
sourceTree = "<group>";
349349
};
350+
0D2FF6501F70D368005C8819 /* Recovered References */ = {
351+
isa = PBXGroup;
352+
children = (
353+
DE1DAA09833A4BD7A378D016 /* libRNBluetoothState.a */,
354+
5D53217D131A43AAB1AFB09E /* libRNiBeacon.a */,
355+
);
356+
name = "Recovered References";
357+
sourceTree = "<group>";
358+
};
350359
0D553C471E793B65007F27E4 /* Products */ = {
351360
isa = PBXGroup;
352361
children = (
@@ -464,6 +473,7 @@
464473
832341AE1AAA6A7D00B99B32 /* Libraries */,
465474
00E356EF1AD99517003FC87E /* BeaconsDemoTests */,
466475
83CBBA001A601CBA00E9B192 /* Products */,
476+
0D2FF6501F70D368005C8819 /* Recovered References */,
467477
);
468478
indentWidth = 2;
469479
sourceTree = "<group>";

examples/BeaconsDemo/ios/BeaconsDemo/Info.plist

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>NSLocationWhenInUseUsageDescription</key>
6+
<string>WRITE YOUR MESSAGE (OR LEAVE BLANK) TO EXPLAIN USER WHY YOU NEED LOCATION SERVICE</string>
7+
<key>NSLocationAlwaysUsageDescription</key>
8+
<string>WRITE YOUR MESSAGE (OR LEAVE BLANK) TO EXPLAIN USER WHY YOU NEED LOCATION SERVICE</string>
9+
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
10+
<string>WRITE YOUR MESSAGE (OR LEAVE BLANK) TO EXPLAIN USER WHY YOU NEED LOCATION SERVICE</string>
511
<key>CFBundleDevelopmentRegion</key>
612
<string>en</string>
713
<key>CFBundleDisplayName</key>
@@ -35,8 +41,6 @@
3541
</dict>
3642
</dict>
3743
</dict>
38-
<key>NSLocationAlwaysUsageDescription</key>
39-
<string>WRITE YOUR MESSAGE (OR LEAVE BLANK) TO EXPLAIN USER WHY YOU NEED LOCATION SERVICE</string>
4044
<key>UIBackgroundModes</key>
4145
<array>
4246
<string>bluetooth-central</string>

0 commit comments

Comments
 (0)