Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何';编辑页面';你是本地人吗?_Reactjs_React Native_Axios - Fatal编程技术网

Reactjs 如何';编辑页面';你是本地人吗?

Reactjs 如何';编辑页面';你是本地人吗?,reactjs,react-native,axios,Reactjs,React Native,Axios,我正在尝试使用react native创建编辑配置文件页面。例如,用户希望更改其用户名,因此应转到配置文件编辑页面。但是从数据库中获取数据后,我无法更新数据。 我尝试使用TextInput值属性。但如果不单击它,它只发送空值。你可以在下面看到我的代码 <View > <TextInput placeholder='Adres' placeholderTextColor='#808e9b' styl

我正在尝试使用react native创建编辑配置文件页面。例如,用户希望更改其用户名,因此应转到配置文件编辑页面。但是从数据库中获取数据后,我无法更新数据。 我尝试使用TextInput值属性。但如果不单击它,它只发送空值。你可以在下面看到我的代码

   <View >
        <TextInput
          placeholder='Adres'
          placeholderTextColor='#808e9b'
          style={styles.biginput}
          multiline={true}
          numberOfLines={50}
          value={this.state.address} 
          onChangeText={Address => this.setState({ Address })}
        />
      </View>

this.setState({Address})
/>
我试着用下面的方法。但它再次发送null

       <View >

        <TextInput
          placeholder='İl'
          placeholderTextColor='#808e9b'
          style={styles.input}
          onChangeText={City => this.setState({ City })}
        >
          {this.state.city} 
        </TextInput>
      </View>

this.setState({City})
>
{本州市}

我应该怎么更新数据?

我认为您在从服务器获取数据时没有设置初始值。因此,如果用户不触摸textInput,则不会设置值,因此它们为空。获取数据集时,请先查看您的状态