ios - React.createElement : type should not be null -


i copied code here.

this throws warning:

warning.

how fix warning?

code:

'use strict';  var react = require('react-native');   // have import scrollview , refreshcontrol  var{      stylesheet,      image,      scrollview,      refreshcontrol,      view,      } = react;  var carousel = require('react-native-looped-carousel');  var dimensions = require('dimensions');  var {width, height} = dimensions.get('window');     var newslistview = react.createclass({      getinitialstate: function () {            return {                isrefreshing: false,              loaded: 0,            };      },         componentdidmount: function () {      },       render: function () {          return (        // if remove  refreshcontrol , warming missing. how fix problem              <scrollview                  style={styles.scrollview}                  refreshcontrol={            <refreshcontrol              refreshing={this.state.isrefreshing}              onrefresh={this._onrefresh}              tintcolor="#ff0000"              title="loading..."               />          }>                     <view>                      <carousel delay={5000} style={{width: width, height: height/4 }}>                            <image                              source={require('rt_xiaoyisigou/image/img_banner.png')                      }                              style={{width: width, height: height/4}}                          />                          <image                              source={require('rt_xiaoyisigou/image/img_banner2.png')}                              style={{width: width, height: height/4}}                            />                          <image                              source={require('rt_xiaoyisigou/image/img_banner3.png')}                              style={{width: width, height: height/4}}                            />                      </carousel>                  </view>              </scrollview>          );      },          _onrefresh() {          this.setstate({isrefreshing: true});          settimeout(() => {              this.setstate({                  loaded: this.state.loaded + 10,                  isrefreshing: false,              });          }, 5000);      },    });    var styles = stylesheet.create({      scrollview: {          flex: 1,      },  });    module.exports = newslistview;

what "suggest" because can't more code is:

1) error because not call react.createelement correctly. should write code in simple segments, suggest chopping in 3 parts, definition, creation , render...

// define element var definitionobject = {    // property called render function returns markup.   render: function() {     return (       <h1 classname="peterpan">         peter pan.       </h1>     );   } }  // create actual element var peterpanelement = react.createclass(definitionobject);   reactdom.render(   <peterpanelement />,   document.getelementbyid('willbereplacedbypeterpanelement') ); 

i hope agree can't deduce more question, if clean question might able out more...


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -