Q: React Native - State inner json updated but component doesn't re render I have an app wherein dynamic buttons are generated matching the state array count, on pressing any button the color of the button needs to be changed. I tried with setNativeProps but always gave me error of cannot read setNativeProps of undefined. 
My code for it was -
    //map function
        <TouchableWithoutFeedback key={index} ref=`btnAnswer_${id}`>
             <View style={{
backgroundColor:questions[currentIndex].selectedAnswer[index]["option_"+index] === false ? 'transparent' : 'green',
padding:10,
width:100,
borderRadius:5
}}>
                <Text>
                  //some text
                </Text>
              </View>
         </TouchableWithoutFeedback>

And have tried accessing the button using these methods -
=> this.refs[`btnAnswer_${id}`].setNativeProps({style:{backgroundColor:'red'}}));

=> var btnRef = `btnAnswer_${id}`
this.btnRef.setNativeProps({style:{backgroundColor:'red'}}));

But was unsuccessful using above methods, so I planned to work with state and get it done, my json state object was like this
    questions= [
    {
        "question_id": 1,
        "option_1": "true",
        "option_2": "false",
sequence: [
            2,
            1
        ],
selectedAnswer: [
            {
                "option_1": false,
                "option_2": false
            }
        ]
    },
    {
        "question_id": 2,
        "option_1": "a",
        "option_2": "b",
        "option_3": "c",
sequence: [
            3,
            2,
            1
        ],
selectedAnswer: [
            {
                "option_1": false,
                "option_2": false,
                "option_3":false
            }
        ]
    }
]

And have manipulated the state on button press event, like this
onButtonPress(questionIndex,answerIndex){
    var questionArray = this.state.questions;
    questionArray[questionIndex].selectedAnswer[answerIndex] 
    ["option_"+answerIndex] = true;
    this.setState({questions:questionArray})
}

Ideally this should update my state and re-render my component and make my button colored as it is set true, but the component doesn't re-renders
Please help.

A: Your component not re-rendering is highly unlikely.
My first tip would be to normalize your data since it is not readable.
Assuming that you are on currentIndex = 0, questionIndex = 0 and answer index = 0, you are saying that on the next component render, it will have this.state.questions[0].selectedAnswer[0].option_0 = true.
Then when reading the background color you are reading questions[0].selectedAnswer[0].option_0. 
Well, either the currentIndex or the index are wrong or on the component you are the questions object is not refering to this.state.questions.
Re-read your code
Anyway, i think you should read directly the backgroundColor from the state, rather than having one boolean and then have to make logic on the render method.

A: Full code for the component would help, but there are a couple things that can be said:
First of all, I do not recommend calling setNativeProps: this is an advanced functionality that has its downsides and it's extremely likely you don't need to do this.
Second, it is indeed  possible that your component is not re-rendering because when you're calling setState, you're passing the current state (although mutated) as the argument to setState!
What you do is: var questionArray = this.state.questions and then you go on mutating the value and passing it to setState. React may compare the two values and because they are the same instance of array (currentState.questions === nextState.questions) react does not see the need to rerender. It does not see that you changed one boolean nested somewhere deep in the state object.
I suggest you read about shouldComponentUpdate, React.PureComponent and immutable data structures (with relation to react). Finally, if you need to handle lots of nested updates to your state, there are libraries that can help you to manage the state. Take a look at immer or mobx.
Third, using array index as a key may be wrong! Read more about react's key. 
