Im получение этого типа ошибки, когда я пытаюсь перейти к следующему виду после получения json response.but мой this.props.navigator.push({id:'HomeCaseList')}
работает хорошо, если я пользователь из стороны мой метод ответа json.может кто-нибудь мне помочь здесь.ТипError: undefined не объект (оценка 'this.props') - React Native
click event
<MKButton
style={{marginLeft:10, marginRight:10,marginTop:10,marginBottom:350,height:40, width:400}}
backgroundColor={'#fff'}
//shadowRadius={2}
//shadowOffset={{width:0, height:2}}
shadowOpacity={.7}
shadowColor="black"
onPress={
// navigator.push();
this.loginToApp.bind(this)
}>
login function
gotoNext() {
fetch('http://url/login/', {
credentials: 'same-origin',
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: 'wasalaa',
password: 'a',
})
}).then(function(response) {
//console.log(response.headers.get('Content-Type'))
//console.log(response.headers.get('Date'))
//console.log(response.status)
//console.log(response.statusText)
//console.log('json',response
//console.log(response.headers.get('JSESSIONID'))
return response.json()
}).then(function(json){
console.log('login response',json)
if(json.message_code === "SUCCESS"){
console.log('user logged')
this.props.navigator.push({
id: 'HomeCaseList',
//sceneConfig: Navigator.SceneConfigs.FloatFromBottom,
});
}
}).catch(function(err){
console.log('error', err)
})
}
Это сработало. Спасибо за быстрый ответ. – kosala