ios - React native doesn't show {this.state.age} in Text -
react native won't display of states in or . they're working functions.
that in code:
import { stylesheet, view, image, text, //important panresponder, animated, dimensions, button, slider, touchablewithoutfeedback, alert, touchableopacity, touchablehighlight, modal, // important } 'react-native'
my constructor:
constructor(props) { super(props); this.state = {modalmenu: false}; this.state = {modalkunst: false}; this.state = {modalartwork: false}; this.state = { viewref: null }; this.state = { age: 150 }; this.state = { farbe: 'black'}; this.state = {modalprice: false}; this.state = { textinputname: '', textinputemail: '', } this.state = { textinputname2: '', textinputemail2: '' } }
to display state:
render() { const {birthday, name, bio, id, id2} = this.props.profile const profileage = this.calcage(birthday) var fbimage = require('./img/bild12.jpg') const rotatecard = this.pan.x.interpolate({ inputrange: [-200, 0, 200], outputrange: ['10deg', '0deg', '-10deg'], }) const animatedstyle = { transform: [ {translatex: this.pan.x}, {translatey: this.pan.y}, {rotate: rotatecard}, ] } return ( <view><text>{this.state.age}</text></view> ); }}
but showing nothing :( don't error nice if me out that. updated render code
in constructor please initialization @ once. every this.state = {} statement overriding previous this.state
replace constructor following code.
this.state = { modalmenu: false, modalkunst: false, viewref: null, age: 150, farbe: 'black', modalprice: false };
Comments
Post a Comment