将 Algolia react

编程入门 行业动态 更新时间:2024-10-10 04:26:40
本文介绍了将 Algolia react-instantsearch 与 react-native 结合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用新的 Algolia react-instantsearch 组件反应原生.

I'm trying to get the new Algolia react-instantsearch component using react-native.

我一直在关注 指南 并且我完全卡住了.

I've been following the guide and I'm completely stuck.

基本上,每当我尝试将 <SearchBox/> 组件添加到 <InstantSearch/> 组件中时,我的应用程序都会以 需要一个组件类,得到 [object Object].

Basically, anytime I try to add my <SearchBox /> component inside the <InstantSearch /> component, my app dies with a Expected a component class, got [object Object].

据我所知,我正在将 连接到 connectSearchBox 连接器,所以我不确定发生了什么.

As far as I can tell, I'm wiring up <SearchBox /> to the connectSearchBox connector so I'm not sure what's going on.

代码(我确实有 appId、apiKey 和索引的实际值):

Code (I do have real values for appId, apiKey, & index):

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, }, });

推荐答案

这个问题现在在 2.0.1 中解决了:github/algolia/instantsearch.js/blob/e15d37362fcd1eb60b5476307160062321983f09/CHANGELOG112d1#CHANGELOG112d1#>

this is now solved in 2.0.1: github/algolia/instantsearch.js/blob/e15d37362fcd1eb60b5476307160062321983f09/CHANGELOG.md#201-2016-12-15

谢谢!

更多推荐

将 Algolia react

本文发布于:2023-11-28 20:14:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643806.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Algolia   react

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!