apply keepawake only when audio or video loaded

This commit is contained in:
balzack 2022-12-01 23:11:53 -08:00
parent bb73e335d9
commit f0dc16db8e
3 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,4 @@
import { Keyboard, KeyboardAvoidingView, ActivityIndicator, Modal, Platform, TextInput, View, TouchableOpacity, Text, } from 'react-native';
import { useKeepAwake } from 'expo-keep-awake';
import { FlatList, ScrollView } from '@stream-io/flat-list-mvcp';
import { memo, useState, useRef, useEffect } from 'react';
import { useConversation } from './useConversation.hook';
@ -59,8 +58,6 @@ export function ConversationBody() {
};
}, []);
useKeepAwake();
const latch = () => {
if (!state.momentum) {
actions.latch();

View File

@ -1,5 +1,6 @@
import { Image, View, Text, TouchableOpacity } from 'react-native';
import { useRef } from 'react';
import { useKeepAwake } from 'expo-keep-awake';
import Colors from 'constants/Colors';
import { Video, AVPlaybackStatus } from 'expo-av';
import { useAudioAsset } from './useAudioAsset.hook';
@ -12,6 +13,8 @@ export function AudioAsset({ topicId, asset, dismiss }) {
const { state, actions } = useAudioAsset(topicId, asset);
useKeepAwake();
const player = useRef(null);
return (

View File

@ -1,5 +1,6 @@
import { ActivityIndicator, Image, View, TouchableOpacity } from 'react-native';
import Colors from 'constants/Colors';
import { useKeepAwake } from 'expo-keep-awake';
import { Video, AVPlaybackStatus } from 'expo-av';
import { useVideoAsset } from './useVideoAsset.hook';
import { styles } from './VideoAsset.styled';
@ -9,6 +10,8 @@ export function VideoAsset({ topicId, asset, dismiss }) {
const { state, actions } = useVideoAsset(topicId, asset);
useKeepAwake();
return (
<View style={styles.container}>
<TouchableOpacity activeOpacity={1} style={styles.container} onPress={actions.showControls}>