Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from "react";
- import {
- StyleSheet,
- View,
- ScrollView,
- Button,
- Text,
- AsyncStorage
- } from "react-native";
- export default class Home extends React.Component {
- static navigationOptions = {
- title: "Название приложения"
- };
- constructor(props) {
- super(props);
- this.state = {
- date: "",
- noteList: []
- };
- }
- displayNoteList = () => {
- return this.state.noteList.map(note => {
- return (
- <View>
- <Text>{note.id}</Text>
- </View>
- )
- })
- }
- componentDidMount() {
- AsyncStorage.getItem('noteList', (error, result) => {
- if (!error) {
- if (result !== null) {
- this.setState({ noteList: result })
- }
- }
- })
- }
- render() {
- return (
- <View>
- { this.displayNoteList() }
- </View>
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement