使用Algolia react-instantsearch和react-native [英] Using Algolia react-instantsearch with react-native

查看:101
本文介绍了使用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.

基本上,任何时候我尝试添加我的 < InstantSearch /> 组件中的< SearchBox /> 组件,我的应用程序以 Expected组件类消失,得到[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].

据我所知,我正在连接< SearchBox /> 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和& index的真实值):

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中已解决: https://github.com/algolia/ Instantsearch.js / blob / e15d37362fcd1eb60b5476307160062321983f09 / CHANGELOG.md#201-2016-12-15

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

谢谢!

这篇关于使用Algolia react-instantsearch和react-native的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆