React Native NOT rendering data from database on IOS

0
135


I have problem with render data on IOS Simulator. Render is work properly on website, but on IOS i still got stucked on “Loading..” text.

Here is my code code

import React from 'react'
import { useState } from 'react';
import { useEffect } from 'react';
import { SafeAreaView, Text, View, StyleSheet, Image, Alert } from 'react-native';
import { Card } from 'react-native-paper'
import firebase from 'firebase'
import Button from '../components/Button'
import Background from '../components/Background'
import TopBar from '../components/TopBar'


export default function HomeScreen({ navigation }) {

  const [data, setData] = useState([])

  const sampleData = [{id:0, title:"One"}, {id:1, title: "Two"}]

  useEffect(() =>
  {
    const donorsData = [];
    firebase.database()
      .ref("testdb")
      .orderByChild("isDonor")
      .equalTo(true)
      .once("value")
      .then((results) => {
        results.forEach((snapshot) => {
          donorsData.push(snapshot.val());
           });
      });
    setTimeout(() => 
    {

      setData(donorsData);

    }, 1500)

  }, [])

  const card = data.length > 0 
  ? data.map(item =>
  {
    return            <Card key={item.uid} style={{ marginBottom: 20, borderRadius: 10, }}>
    <Text>{item.name}</Text>
    <Text>{item.description}</Text>
    <Image src={item.photo}></Image>
  </Card>
  })
  
      : <Text>Loading...</Text>



  return (
    <View style={styles.container}>
      
      {card}
      
    </View>
  );
}

On website is everything ok Website Screen

But on IOS Simulator i got only Loading

IOS Screen

I try a lot of solutions finded here, but no one works with this case. I think is propably becouse iOS dont have data? When i put console log at to top of return, i got nothing.