React Native:更新ListView问题

时间:2016-07-06 09:41:23

标签: react-native

我需要在输入textinput>时更新Listview 2个符号。我从API获取数据,并且2个字符后面的每个新符号都必须更新建议的变体(新数据源)。无法找到我的错误。非常感谢解决方案:)

源代码: https://rnplay.org/apps/msxitg

1 个答案:

答案 0 :(得分:2)

错误在第54行:

$stack = HandlerStack::create();
$middleware = new Oauth1([
        'consumer_key' => $params['consumerKey'],
        'consumer_secret' => $params['consumerSecret'],
        'token_secret' => false,
    ]);

$stack->push($middleware);
$client=new Client([
        'base_uri' => $params['baseUri'],
        'handler' => $stack,
        'auth' => 'oauth'
]);

//Leg #1: Obtain application request token  
$requestTokenResponse = $client->post('/oauth/request')->getBody()->getContents();
/* requestTokenResponse now contains in a single string variable with value: 
 *'oauth_token=4plbxbL9Um9J6IN7XLDy5DYDwJlrISQ5QMqi43JaXaQ&
 * oauth_callback_confirmed=true&
 * oauth_token_secret=JqCC51ja3Q2yklV2xyphUromHGhIwWjgcx%40hXvO3JosbkYWKVr'
*/
$requestTokenParams = [];
foreach (explode('&',$requestTokenResponse) as $queryString) {
        $query = explode('=', $queryString);
        $requestTokenParams[$query[0]] = $query[1];
}
//Leg #2 Starts Here

//Dynamically add middleware params (setting token and token_secret?) 

//Obtain access token after middleware update
    $accessTokenResponse = $client->post('/oauth/access')->getBody()->getContents();

responseJSON.result.items是具有名称键的对象列表。您必须将此更改为以下内容,它将起作用:

API_RESPONSE_ARRAY = responseJSON.result.items.name;

可以在此处找到有效的分叉版本https://rnplay.org/apps/WDXSHw

PS。也许你知道它,但因为它不需要componentWillReceiveProps函数,而且目前根本没有调用它。