title: React Native: You attempted to set the key on an object that is meant to be immutable and has been frozen
body: <p>I am new to react native and was creating my first. </p>
  
  <p>In my add I decided to change the backgroundColor of my App dynamically for which I did something like this </p>
  
  <pre><code>let style = StyleSheet.flatten({
      upperRow: {
          display: "flex",
          flexDirection: "row",
          marginBottom: 5, 
          backgroundColor: "white"
      },
  })
  
  let {
      upperRow
  } = style 
  </code></pre>
  
  <p>And then something like this in <code>componentWillReceiveProps</code></p>
  
  <pre><code>componentWillReceiveProps(nextProps) {
  
      if (this.props.coinPrice != nextProps.coinPrice ) {
         if (this.props.coinPrice &gt; nextProps.coinPrice) {
          console.log("previous value is greater")
             //change background color to red
             upperRow["backgroundColor"] = "#ffe5e5"
             console.log(upperRow)
             //We 
         }
       }
      }
  </code></pre>
  
  <p>This is throwing following error</p>
  
  <blockquote>
    <p>You attempted to set the key <code>backgroundColor</code> with the value
    <code>#ffe5e5</code>  on an object that is meant to be immutable and has been
    frozen.</p>
  </blockquote>
  
  <p><strong>Question:</strong> Can anyone tell me what is going wrong here? </p>