mirror of
https://github.com/balzack/databag.git
synced 2025-02-14 20:49:16 +00:00
apply keepawake only when audio or video loaded
This commit is contained in:
parent
bb73e335d9
commit
f0dc16db8e
@ -1,5 +1,4 @@
|
|||||||
import { Keyboard, KeyboardAvoidingView, ActivityIndicator, Modal, Platform, TextInput, View, TouchableOpacity, Text, } from 'react-native';
|
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 { FlatList, ScrollView } from '@stream-io/flat-list-mvcp';
|
||||||
import { memo, useState, useRef, useEffect } from 'react';
|
import { memo, useState, useRef, useEffect } from 'react';
|
||||||
import { useConversation } from './useConversation.hook';
|
import { useConversation } from './useConversation.hook';
|
||||||
@ -59,8 +58,6 @@ export function ConversationBody() {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useKeepAwake();
|
|
||||||
|
|
||||||
const latch = () => {
|
const latch = () => {
|
||||||
if (!state.momentum) {
|
if (!state.momentum) {
|
||||||
actions.latch();
|
actions.latch();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Image, View, Text, TouchableOpacity } from 'react-native';
|
import { Image, View, Text, TouchableOpacity } from 'react-native';
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
|
import { useKeepAwake } from 'expo-keep-awake';
|
||||||
import Colors from 'constants/Colors';
|
import Colors from 'constants/Colors';
|
||||||
import { Video, AVPlaybackStatus } from 'expo-av';
|
import { Video, AVPlaybackStatus } from 'expo-av';
|
||||||
import { useAudioAsset } from './useAudioAsset.hook';
|
import { useAudioAsset } from './useAudioAsset.hook';
|
||||||
@ -12,6 +13,8 @@ export function AudioAsset({ topicId, asset, dismiss }) {
|
|||||||
|
|
||||||
const { state, actions } = useAudioAsset(topicId, asset);
|
const { state, actions } = useAudioAsset(topicId, asset);
|
||||||
|
|
||||||
|
useKeepAwake();
|
||||||
|
|
||||||
const player = useRef(null);
|
const player = useRef(null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { ActivityIndicator, Image, View, TouchableOpacity } from 'react-native';
|
import { ActivityIndicator, Image, View, TouchableOpacity } from 'react-native';
|
||||||
import Colors from 'constants/Colors';
|
import Colors from 'constants/Colors';
|
||||||
|
import { useKeepAwake } from 'expo-keep-awake';
|
||||||
import { Video, AVPlaybackStatus } from 'expo-av';
|
import { Video, AVPlaybackStatus } from 'expo-av';
|
||||||
import { useVideoAsset } from './useVideoAsset.hook';
|
import { useVideoAsset } from './useVideoAsset.hook';
|
||||||
import { styles } from './VideoAsset.styled';
|
import { styles } from './VideoAsset.styled';
|
||||||
@ -9,6 +10,8 @@ export function VideoAsset({ topicId, asset, dismiss }) {
|
|||||||
|
|
||||||
const { state, actions } = useVideoAsset(topicId, asset);
|
const { state, actions } = useVideoAsset(topicId, asset);
|
||||||
|
|
||||||
|
useKeepAwake();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<TouchableOpacity activeOpacity={1} style={styles.container} onPress={actions.showControls}>
|
<TouchableOpacity activeOpacity={1} style={styles.container} onPress={actions.showControls}>
|
||||||
|
Loading…
Reference in New Issue
Block a user