globocom / react-native-draftjs-render

React Native render for draft.js model
MIT License
390 stars 62 forks source link

Error: Invariant Violation: Object are not valid as react child. #35

Closed Kliton closed 6 years ago

Kliton commented 6 years ago

Here my code:

import {StyleSheet, ScrollView, View, Button} from 'react-native';
import React, {Component} from 'react';
import {
  Container,
  Header,
  Content,
  List,
  Toast,
  ListItem,
  Text,
  Icon,
  Footer,
  Left,
  Body,
  Right,
  Separator
} from 'native-base';

import getRNDraftJSBlocks from 'react-native-draftjs-render';
import data from './content.json';

export default class App extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      question: "",
      answer: "",
      showAnswer: false
    }
  }

  render() {

  const params = {
    contentState: data
  };
  const blocks = getRNDraftJSBlocks(params);

  return (
    <ScrollView contentContainerStyle={styles.container}>
      {blocks}
    </ScrollView>
  );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'space-around'
  }
});
raphaelpor commented 6 years ago

Hi @Kliton!

The problem may be on data. Could you please paste it here? Also, what version of react-native-draftjs-render are you using?

raphaelpor commented 6 years ago

Hi @Kliton!

Do you have any update about this error? It would be greatly appreciated.