Попытка импортировать файл Json, а затем изучить и отобразить его в приложении React Native. Я только изучаю React Native, и в то же время Javascript.
import React, { Component } from 'react';
import {
Text,
View,
AsyncStorage
} from 'react-native';
import{eventos} from './Events';
export default class Admin extends React.Component{
constructor(props){
super(props);
this.state={
eventos
}
try{
AsyncStorage.getItem(eventos).then((value)=>{
if(value!=null){
console.log("Events esta completo")
}else{
console.log("Events esta vacio")
}
this.setState({
eventos:JSON.parse(value)
})
})
}catch(err){
console.log(err)
}
}
parseEventsData(){
console.log("Deberia salir algo")
return this.state.events.map((eventos,i)=>{
return(
<View key={i}>
<Text>
{eventos.title}
</Text>
<Text>
{eventos.responsible}
</Text>
<Text>
{eventos.description}
</Text>
</View>
)
})
}
render(){
return(
<View>
{this.parseEventsData()}
<Text>No salio nada</Text>
</View>
);
}
}
Следующим является Json.
введите изображение описание здесь
И это ошибка, которую я получаю.
введите описание изображения здесь
Я только изучаю React Native, и в в то же время Javascript.
введите описание изображения здесь