diff --git a/lib/ARRunningState.ios.js b/lib/ARRunningState.ios.js
index 60429d2..98f81a4 100644
--- a/lib/ARRunningState.ios.js
+++ b/lib/ARRunningState.ios.js
@@ -1,14 +1,14 @@
// @flow
-import { Ionicons } from '@expo/vector-icons';
-import { AR } from 'expo';
+import {Ionicons} from '@expo/vector-icons';
+import {AR} from 'expo';
import React from 'react';
-import { TouchableOpacity, View } from 'react-native';
+import {TouchableOpacity, View} from 'react-native';
// import AR from '../__tests__/AR.mock';
class IconButton extends React.PureComponent {
render() {
- const { style, onPress, icon } = this.props;
+ const {style, onPress, icon} = this.props;
return (
-
+
);
@@ -27,13 +27,21 @@ class IconButton extends React.PureComponent {
}
class ARRunningState extends React.Component {
- state = { running: true };
+ state = {running: true};
componentDidMount() {
if (AR.isAvailable()) {
this._onSessionWasInterrupted = AR.onSessionWasInterrupted(() => {
this.pause();
});
+
+
+ if (this.state.running) {
+ setTimeout(function () {
+ this.runNow();
+ }.bind(this), 1000);
+
+ }
}
}
@@ -56,7 +64,7 @@ class ARRunningState extends React.Component {
},
this.props.style,
]}>
-
+
);
}
@@ -74,10 +82,10 @@ class ARRunningState extends React.Component {
};
toggleRunning = () => {
- this.setState({ running: !this.state.running }, () => {
+ this.setState({running: !this.state.running}, () => {
if (!AR.isAvailable()) return;
- const { running } = this.state;
+ const {running} = this.state;
if (running) {
AR.resume();
} else {
@@ -86,8 +94,17 @@ class ARRunningState extends React.Component {
});
};
+ runNow = () => {
+ this.setState({running: true}, () => {
+ if (!AR.isAvailable()) return;
+ AR.resume();
+
+ });
+ };
+
get iconName() {
return this.state.running ? 'md-play' : 'md-pause';
}
}
+
export default ARRunningState;