在react-native中键入错误

时间:2018-06-06 12:38:22

标签: reactjs react-native graphql react-apollo aws-appsync

我是新的反应原生和aws appsync,graphql.we正在尝试实现我们将有一个发送按钮的功能,所以一旦我们点击发送按钮,文本应该出现在屏幕上。我们已经实现了它,但是一旦我们达到它,我们就会收到错误说

  

输入错误   我们不知道造成这个错误的原因

     

Type error

     

Warning 1

     

Warning 2

import React, { Component } from 'react';
import { View, Text, Button, FlatList, StyleSheet, Alert } from 'react-native';
import ChatView from './ChatView';
//import onCreatePostMessage from './query/onCreatePostMessage';

export default class ChatHistory extends Component {
  constructor(props) {
      super(props);
}

componentWillMount() {
     this.props.onCreatePostMessage();
}

render() {
    return (
          <View style={styles.container}>
              <Text>ChatHistory</Text>
              <FlatList data={[].concat(this.props.chats).sort((a, b) => a.createdAt.localeCompare(b.createdAt))} 
                keyExtractor={(item, index) => index.toString()}
                renderItem={({item}) => <ChatView chat={item}/>}
                ref={ref => this.flatList = ref}
                onContentSizeChange={() => this.flatList.scrollToEnd({animated: true})}
                onLayout={() => this.flatList.scrollToEnd({animated: true})} />
          </View>
        );
    }
}


const styles = StyleSheet.create({
    container: {
        flex: 1,
        paddingTop: 20
    }
});

请帮我解决这个问题!!谢谢

0 个答案:

没有答案