@quintype/native-components 2.29.3 → 2.29.4-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/native-components",
3
- "version": "2.29.3",
3
+ "version": "2.29.4-beta.1",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -20,7 +20,7 @@ import Icon from 'react-native-vector-icons/AntDesign';
20
20
  import TrackPlayer, { usePlaybackState, Capability, State, AppKilledPlaybackBehavior, useProgress } from "react-native-track-player";
21
21
  import MaterialIcon from "react-native-vector-icons/MaterialCommunityIcons";
22
22
  import FontAwesomeIcon from "react-native-vector-icons/FontAwesome";
23
- import { isDetoxSync } from 'react-native-is-detox';
23
+ import { isDetox } from 'react-native-is-detox';
24
24
 
25
25
  import Modal from 'react-native-modal';
26
26
 
@@ -162,9 +162,9 @@ export const Story = ({
162
162
  const cards = story?.cards ?? [];
163
163
  const [showModal, setShowModal] = useState(false);
164
164
  const [audioRate, setAudioRate] = useState(1);
165
+ const [progressInterval, setProgressInterval] = useState(undefined);
165
166
  const playbackState = usePlaybackState();
166
- const isDetox = isDetoxSync();
167
- const progress = useProgress(isDetox ? 2000 : undefined);
167
+ const progress = useProgress(progressInterval);
168
168
  const [isFinishedPlaying, setFinishedPlaying] = useState(false);
169
169
 
170
170
 
@@ -243,6 +243,14 @@ export const Story = ({
243
243
  return async() => await TrackPlayer.pause();
244
244
  }, []);
245
245
 
246
+ useEffect(() => {
247
+ const checkDetox = async () => {
248
+ const isRunningInDetox = await isDetox();
249
+ setProgressInterval(isRunningInDetox ? 2000 : undefined);
250
+ };
251
+ checkDetox();
252
+ }, []);
253
+
246
254
  useEffect(()=>{
247
255
  if(progress?.duration < progress.position + 1 && progress.position !== 0){
248
256
  setFinishedPlaying(true);