Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!