При вызове firebase.db возникает ошибка, Property 'db' does not exist on type '() => Promise'.ts(2339)
Как это исправить?
import './services/firebase';
import * as Font from 'expo-font';
import * as SplashScreen from 'expo-splash-screen';
import { StatusBar } from 'expo-status-bar';
import React, { useState, useEffect, useCallback } from 'react';
import AntDesign from '@expo/vector-icons/AntDesign';
import { StyleSheet, Text, View, TouchableOpacity } from 'react-native';
import Moment from 'react-moment';
import 'moment/locale/uk';
import DateSlider from './components/date_slider';
import LessonList from './components/lesson_list'
import Lessons_local from './components/data.json';
import theme from './assets/themes';
import { firebase } from './services/firebasedb';
// import { lessons } from './services/lessonsService'
export default function App() {
const [appIsReady, setAppIsReady] = useState(false);
const [index, setIndex] = useState(0);
const [lessons, setLessons] = useState();
useEffect(() => {
async function prepare() {
try {
await SplashScreen.preventAutoHideAsync();
await Font.loadAsync(AntDesign.font);
let data = await firebase.db.ref('UpcomingGames').once('value', snapshot => {
data = snapshot.val()
console.log('upcoming t2',data)
return data
})
setLessons(data);
} catch (e) {
console.warn(e);
} finally {
setAppIsReady(true);
}
}
prepare();
}, []);