Skip to content

Instantly share code, notes, and snippets.

@emilyruby
emilyruby / start_ranging.js
Created April 14, 2018 14:52
Start Ranging for Beacons in React-Native
await Beacons
.startRangingBeaconsInRegion(
'IBeacons',
'uuid'
)
@emilyruby
emilyruby / handlerange.js
Created April 14, 2018 15:08
Code for the HandleRange function
handleRange = (data) => {
for (var i = 0; i < data.beacons.length; i++) {
if (this.state.activeChallenge && data.beacons[i].uuid === this.state.activeChallenge.BeaconIDs[0]) {
this.solvedChallenge();
}
}
}
npm install --save react-native-beacons-manager
class ExampleButton extends React.Component {
handleClick = () => {
console.log("I've been clicked!")
};
render() {
return (
<button onClick={this.handleClick}>
Click me!
</button>