Westonci.ca makes finding answers easy, with a community of experts ready to provide you with the information you seek. Explore thousands of questions and answers from a knowledgeable community of experts on our user-friendly platform. Explore comprehensive solutions to your questions from a wide range of professionals on our user-friendly platform.

How to use a state value in stylesheet in react native.

Sagot :

Answer:

Change this code:

return <View style={[styles.container, backgroundColor: this.state.bg]}/>

for this code:

return <View style={[styles.container, {backgroundColor: this.state.bg}]}/>