prevent sleep while in topic

This commit is contained in:
Roland Osborne 2022-10-19 14:17:20 -07:00
parent 9e5f1b5c6a
commit 8c01f67b5d
2 changed files with 7 additions and 0 deletions

View File

@ -18,6 +18,7 @@
"axios": "^1.1.0",
"expo": "~46.0.9",
"expo-av": "^12.0.4",
"expo-keep-awake": "~10.2.0",
"expo-splash-screen": "~0.16.2",
"expo-status-bar": "~1.4.0",
"moment": "^2.29.4",

View File

@ -1,4 +1,5 @@
import { KeyboardAvoidingView, Modal, Platform, TextInput, View, TouchableOpacity, Text, } from 'react-native';
import { activateKeepAwake, deactivateKeepAwake } 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';
@ -38,6 +39,11 @@ export function ConversationBody() {
const ref = useRef();
useEffect(() => {
activateKeepAwake();
return () => { deactivateKeepAwake() };
}, []);
const latch = () => {
if (!state.momentum) {
actions.latch();