Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

204
Visualizações
Unable to list data sent with push

[enter image description here]

I have 3 recording screens and I want to list user information on a single page.But each is assigned a separate pushKey. I also can't use these pushKeys to access the database in the code section

{
  const user = firebase.auth().currentUser.uid;
  const db = firebase.database();

  const ref = db.ref('kullaniciBilgiler/'+`${user}`);
  
  
 
    ref.once('value', (snapshot) => {
       var data=snapshot.val();
      console.log(data)
      
    }, (errorObject) => {
      console.log('The read failed: ' + errorObject.name);
    });

  

   
 


export default class profile extends Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }



  render() {


    var box = [];

    for(let i = 0; i <= 5; i++){
  
      box.push(

        <View style={{flexDirection:'row'}}>
        <View style={styles.textBox}>
          <Text style={styles.textMid}>Soyisim</Text>
        </View>
        <View style={styles.inputView}>                     
            <TextInput                         
             onChangeText={(text)=>setList(text)}
              style={styles.input}
           />
        </View>    
        </View>
      
      )
    }
    return (
      <ScrollView>
      <SafeAreaView style={styles.container} >
       
        <View style={styles.profilePhoto}>
         <Image 
         style={{
          width: 100,
          height: 100,
          resizeMode: 'contain',
          marginTop:40
        }}
        source={
          require('../../image/logo.png')
        }
         
         />

        </View>
        <View style={styles.profileDetails}>
                  
    {box}
                    

   </View>
                  
          
      </SafeAreaView>
      </ScrollView>
    );    
  }
}
}

I can't get random keys assigned by push and I can't access information from the database

[enter image description here]

_handleSubmit = (values) => {


auth()
  .createUserWithEmailAndPassword(values.email, values.password)
  .then(() => {
    userId = firebase.auth().currentUser.uid;
    if (userId) {
      var database = firebase.database().ref('kullaniciBilgiler/').child(userId).push();
      database.set({
        name: values.name,
        surname: values.surname,
        email: values.email,

      }).then(() => console.log('okey'));
    }

This register code

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

When a new user is created by createUserWithEmailAndPassword, set all of user's data right under the UID node instead of pushing new nodes. This can be done by using set() instead of push():

const userId = firebase.auth().currentUser.uid;

const database = firebase.database().ref('kullaniciBilgiler/' + userId)

database.set({
  name: values.name,
  surname: values.surname,
  email: values.email,
}).then(() => console.log('okey'));

// similarly use 'update()' when adding other fields later

When you query user's node, it should now return an object like this:

{
  name: '',
  surname: '',
  email: '',
  age: 0,
  ...otherFields
}

You can read more about updating data in the documentation.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda