Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda