title: Update a value in React Native Realm Database
body: <p>I have a realm database in my React Native Project. I want to update the value of the language in another page. I was able to write the value initially but am I Am stuck updating it. Below is my code.</p>
  
  <p><strong>Profile Schema (Realm Database Schema)</strong></p>
  
  <p>'use strict';</p>
  
  <pre><code>import Realm from 'realm';
  
  class Profile extends Realm.Object {}
  Profile.schema = {
      name: 'Profile',
      properties: {
          Onetime: 'string',
          Name: 'string',
          Email: 'string',
          Phone: 'string',
          Language:'string',
          Url:'string',
      },
  };
  
  
  
  export default new Realm({schema: [Profile]});
  </code></pre>
  
  <p><strong>Loading Initial Data</strong></p>
  
  <pre><code>let objects = realm.objects('Profile');
  
      var name,url,phone,onetime;
  
  
      if (firebase.auth().currentUser.displayName == null ) {
        onetime= 'true';
        name= 'Name';
        url = 'https://media2.giphy.com/media/sbLpwwHlgls8E/giphy.gif';
        phone = '0000000000';
      }
      else {
        onetime= 'true';
        name=firebase.auth().currentUser.displayName;
        url=firebase.auth().currentUser.photoURL;
        phone = '0000000000';
      }
  
      if (objects.length == 0) {
  
      realm.write(() =&gt; {
      realm.create('Profile', { Onetime: onetime, Name: name, Email: firebase.auth().currentUser.email, Phone:phone, Language: 'e', Url: url, });
      });
      }
  
      else {
          realm.write(() =&gt; {
          realm.delete(objects);
          realm.create('Profile', { Onetime: onetime, Name: name, Email: firebase.auth().currentUser.email, Phone:phone, Language: 'e', Url: url, });
      });
  
  
      }
  </code></pre>
  
  <p><strong>Activity where I have to update the value</strong> </p>
  
  <pre><code>import React from 'react';
  import {
    ScrollView,
    View,
    StyleSheet
  } from 'react-native';
  import {
    RkText,
    RkTextInput,
    RkAvoidKeyboard,
    RkTheme,
    RkStyleSheet
  } from 'react-native-ui-kitten';
  import {SocialSetting} from '../../components';
  import {FontAwesome} from '../../assets/icons';
  import {GradientButton} from '../../components';
  import Avatar from 'react-native-interactive-avatar';
  import ImagePicker from 'react-native-image-crop-picker';
  import realm from '../../realm';
  import firebase from 'firebase';
  import {RkSwitch} from '../../components/switch/index';
  import RadioForm, {RadioButton, RadioButtonInput, RadioButtonLabel} from 'react-native-simple-radio-button';
  
  var radio_props = [
    {label: 'English       ', value: 'e' },
    {label: 'Malayalam', value: 'm'}
  
  ];
  
  var lange = '';
  
  var objects = realm.objects('Profile');
  
  export class ProfileSettings extends React.Component {
    static navigationOptions = {
      title: 'Profile Settings'.toUpperCase()
    };
  
    constructor(props) {
      super(props);
  
  
  
  
      this.state = {
        name: objects[0].Name,
        email: objects[0].Email,
        phone: objects[0].Phone,
        language:objects[0].Language,
        url:objects[0].Url,
        lang:''
  
      }
  
    }
  
  
  
  
      pickimage(){
  
        ImagePicker.openPicker({
          width: 300,
          height: 400,
          cropping: true
        }).then(image =&gt; {
          console.log("imagelink- "+image);
        });
      }
  
      handleLogOut() {
          firebase.auth().signOut();
      }
  
      handleSave() {
  
            alert("Language is: "+lange);
  
  
      }
  
      updateuser(){
  
        var user = firebase.auth().currentUser;
  
       user.updateProfile({
       displayName: this.state.name,
       email: this.state.email
  }).then(function() {
      alert("Update SuccessFull");
  }).catch(function(error) {
    // An error happened.
    alert("Update Failed");
  });
  
  
    }
  
  
  
    render() {
  
      if (this.state.language == 'e') {
  
        var val = 0;
  
        }
  
        else {
          var val = 1;
        }
  
  
  
  
      return (
        &lt;ScrollView style={styles.root}&gt;
          &lt;RkAvoidKeyboard&gt;
            &lt;View style={styles.header}&gt;
            &lt;Avatar
                 uri={this.state.url}
                 size={'default'}
             /&gt;
            &lt;/View&gt;
            &lt;View style={styles.section}&gt;
              &lt;View style={[styles.row, styles.heading]}&gt;
                &lt;RkText rkType='header6 primary'&gt;INFO&lt;/RkText&gt;
              &lt;/View&gt;
              &lt;View style={styles.row}&gt;
                &lt;RkTextInput label='Name'
                             value={this.state.name}
                             rkType='right clear'
                             onChangeText={(text) =&gt; this.setState({name: text})}/&gt;
              &lt;/View&gt;
  
              &lt;View style={styles.row}&gt;
                &lt;RkTextInput label='Email'
                             value={this.state.email}
                             onChangeText={(text) =&gt; this.setState({email: text})}
                             rkType='right clear'/&gt;
              &lt;/View&gt;
  
  
  
            &lt;/View&gt;
  
  
  
            &lt;View style={styles.section}&gt;
              &lt;View style={[styles.row, styles.heading]}&gt;
                &lt;RkText rkType='primary header6'&gt;CHOOSE YOUR LANGUAGE&lt;/RkText&gt;
              &lt;/View&gt;
  
              &lt;View&gt;
              &lt;View style={styles.radio}&gt;
            &lt;RadioForm
              radio_props={radio_props}
              initial={val}
              onPress={(value) =&gt; {
                {
                this.setState({lang:value})
                this.setState({language: this.state.lang})
                lange = value;
  
  
              }}}
            /&gt;
  
            &lt;/View&gt;
          &lt;/View&gt;
            &lt;/View&gt;
            &lt;GradientButton rkType='large' style={styles.button} text='SAVE' onPress={this.handleSave} /&gt;
            &lt;GradientButton rkType='large' style={styles.button} text='LOGOUT' onPress={this.handleLogOut}/&gt;
          &lt;/RkAvoidKeyboard&gt;
        &lt;/ScrollView&gt;
      )
    }
  }
  
  let styles = RkStyleSheet.create(theme =&gt; ({
    root: {
      backgroundColor: theme.colors.screen.base
    },
    header: {
      backgroundColor: theme.colors.screen.neutral,
      paddingVertical: 25,
      justifyContent: 'center',
      alignItems: 'center'
    },
    section: {
      marginVertical: 25
    },
    radio: {
      flexDirection:'row',
      margin:20
    },
    heading: {
      paddingBottom: 12.5
    },
    row: {
      flexDirection: 'row',
      paddingHorizontal: 17.5,
      marginTop:15,
      borderBottomWidth: StyleSheet.hairlineWidth,
      borderColor: theme.colors.border.base,
      alignItems: 'center',
      justifyContent: 'space-between',
      flex:1
    },
    button: {
      marginHorizontal: 16,
      marginBottom: 32
    }
  }));
  </code></pre>
  
  <p>I want to update the value of language in the <strong>handleSave()</strong></p>
  
  <p>Any help would be highly appreciated.</p>
  
  <p>Thanks in Advance.</p>