我正在尝试获取新的 Algolia反应即时搜索使用react-native的组件。
我一直在关注guide我完全被困住了。
基本上,每当我尝试添加我的<SearchBox />
里面的组件<InstantSearch />
组件,我的应用程序死了期望一个组件类,得到 [object Object].
据我所知,我正在接线<SearchBox />
to the connectSearchBox
连接器,所以我不确定发生了什么。
Code (I do有 appId、apiKey 和索引的真实值):
import React, {Component} from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
ListView,
TextInput,
Image,
} from 'react-native';
import {InstantSearch} from 'react-instantsearch/native';
import {connectSearchBox} from 'react-instantsearch/connectors';
import * as Styles from '../../styles/';
const SearchBox = connectSearchBox(({currentRefinement, refine}) =>
<TextInput
style={{height: 40, borderColor: 'gray', borderWidth: 1}}
onChangeText={(text) => refine(text)}
value={currentRefinement}
/>);
export default class InfiniteSearch extends Component {
constructor(props) {
super(props);
}
render() {
return (
<View style={styles.container}>
<InstantSearch
className="container-fluid"
appId="appId"
apiKey="apiKey"
indexName="indexName"
>
<SearchBox />
</InstantSearch>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
padding: 10,
},
});