Skip to content

Check the render method of 'BoardScreen' #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
David278705 opened this issue Jun 2, 2020 · 0 comments
Open

Check the render method of 'BoardScreen' #4

David278705 opened this issue Jun 2, 2020 · 0 comments

Comments

@David278705
Copy link

Hello, I have an error on the BoardScreen screen which gives me this error: 'Check the render method of' BoardScreen ''

import React, { Component } from 'react';
import { StyleSheet, ScrollView, ActivityIndicator, View, Text } from 'react-native';
import { List, ListItem, Button, Icon } from 'react-native-elements';
import firebase from '../Firebase';

class BoardScreen extends Component {
static navigationOptions = ({ navigation }) => {
return {
title: 'Board List',
headerRight: (
<Button
buttonStyle={{ padding: 0, backgroundColor: 'transparent' }}
icon={{ name: 'add-circle', style: { marginRight: 0, fontSize: 28 } }}
onPress={() => { navigation.push('AddBoard') }}
/>
),
};
};
constructor() {
super();
this.ref = firebase.firestore().collection('boards');
this.unsubscribe = null;
this.state = {
isLoading: true,
boards: []
};
}
componentDidMount() {
this.unsubscribe = this.ref.onSnapshot(this.onCollectionUpdate);
}
onCollectionUpdate = (querySnapshot) => {
const boards = [];
querySnapshot.forEach((doc) => {
const { title, description, author } = doc.data();
boards.push({
key: doc.id,
doc, // Documentos
title,
description,
author,
});
});
this.setState({
boards,
isLoading: false,
});
}
render() {
if(this.state.isLoading){
return(



)
}
return (


{
this.state.boards.map((item, i) => (
<ListItem
key={i}
title={item.title}
leftIcon={{name: 'book', type: 'font-awesome'}}
onPress={() => {
this.props.navigation.navigate('BoardDetails', {
boardkey: ${JSON.stringify(item.key)},
});
}}
/>
))
}


);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
paddingBottom: 22
},
item: {
padding: 10,
fontSize: 18,
height: 44,
},
activity: {
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0,
alignItems: 'center',
justifyContent: 'center'
}
})

export default BoardScreen;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant