Skip to content

Instantly share code, notes, and snippets.

@dceddia
Created June 15, 2018 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dceddia/15f551ac1b0888fbb4bcb8fdb6f1445c to your computer and use it in GitHub Desktop.
Save dceddia/15f551ac1b0888fbb4bcb8fdb6f1445c to your computer and use it in GitHub Desktop.
Timers trigger more timers.
takePicture = () => {
this.camera.takePictureAsync({
quality: 0.1,
base64: true,
exif: false
}).then(photo => {
this.setState({ photo });
// In 27 seconds, turn the camera back on
setTimeout(() => {
this.setState({ photo: null });
}, PHOTO_INTERVAL - FOCUS_TIME);
// In 30 seconds, take the next picture
setTimeout(this.takePicture, PHOTO_INTERVAL);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment