小编Blo*_*dsq的帖子

React Native-调用mapStateToProps,但不重新渲染

我现在开始了两个星期的React Native / Redux开发工作,并且mapStateToProps和重新渲染存在一些问题。

这是事实:

  • 使用正确的状态(新状态)正确调用mapStateToProps
  • 在mapStateToProps之后未调用render函数
  • 我已经检查过Redux的问题排查页面,并且没有可变的问题

这是代码:

零件

import React from 'react';
import { connect } from 'react-redux';
import { View, StyleSheet } from 'react-native';
import { Item, Input, Button, Text } from 'native-base';
import { signup } from './../actions/signup.action';

class Signup extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            email: '',
            password: '',
            confirmPassword: ''
        };
    }

    render() {
        console.log('rendering', this.props);

        return (
            <View style={styles.container}>
                <Item rounded>
                    <Input placeholder='Email' onChangeText={(text) => this.setState({email: text})} value={this.state.email} />
                </Item> …
Run Code Online (Sandbox Code Playgroud)

react-native react-redux

5
推荐指数
1
解决办法
1016
查看次数

标签 统计

react-native ×1

react-redux ×1