Skip to content
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

expected a component class got object object #1730

Closed
danielevz opened this issue Dec 9, 2016 · 1 comment
Closed

expected a component class got object object #1730

danielevz opened this issue Dec 9, 2016 · 1 comment

Comments

@danielevz
Copy link

danielevz commented Dec 9, 2016

I get this error on react native "expected a component class got object object"

I'm just copy pasting thhe code that appears on the instantsearch guide of react native (InstantSearch) to my new and clean project that appears in here: https://community.algolia.com/instantsearch.js/react/guide/React_native.html

import React, {Component} from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
ListView,
TextInput,
Image,
} from 'react-native';
import {InstantSearch} from 'react-instantsearch/native';
import {connectSearchBox, connectInfiniteHits} from 'react-instantsearch/connectors';

export default InfiniteSearch = () =>





;

const SearchBox = connectSearchBox(({currentRefinement, refine}) =>
<TextInput
style={{height: 40, borderColor: 'gray', borderWidth: 1}}
onChangeText={(text) => refine(text)}
value={currentRefinement}
/>
);

const Hits = connectInfiniteHits(React.createClass({
onEndReached: function () {
if (this.props.hasMore) {
this.props.refine();
}
},

render: function () {
const dataSource = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
const hits = this.props.hits.length > 0 ?


:
null;

return hits;

},

_renderRow: function (hit) {
return (

<Image
style={{height: 100, width: 100}}
source={{uri: hit.image}}
/>
{hit.name}
);
},
}));

const styles = StyleSheet.create({
maincontainer: {
backgroundColor: 'white',
flex: 1,
paddingTop: 20,
paddingBottom: 10,
flexDirection: 'column',
},
list: {
flex: 1,
flexDirection: 'column',
},
item: {
flexDirection: 'row',
alignItems: 'center',
backgroundColor: 'white'
}
});

AppRegistry.registerComponent('InfiniteSearch', () => InfiniteSearch);

@iam4x
Copy link
Contributor

iam4x commented Dec 10, 2016

@bobylito is working on a patch #1729 👍

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

No branches or pull requests

4 participants