首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >简单React本机应用程序的不变冲突与渲染错误

简单React本机应用程序的不变冲突与渲染错误
EN

Stack Overflow用户
提问于 2021-12-10 11:08:30
回答 1查看 443关注 0票数 0

新的反应本地人所以道歉,如果这是一个新手的问题。我正在使用世博会,我的应用程序在网上工作,但当我通过世博会使用iOS时,我得到了两个类别的18个错误。下面将详细介绍一个Invariant Violation,一个Render Error

错误1级

代码语言:javascript
运行
复制
Invariant Violation: View config getter callback for component `input` must be a function (received `undefined`). Make sure to start component names with a capital letter.

This error is located at:
    in input
    in Unknown
    in span
    in Unknown
    in div (created by FormGroup)
    in FormGroup (created by App)
    in form (created by Form)
    in Form (created by App)
    in RCTView (created by View)
    in View (created by App)
    in App (created by ExpoRoot)
    in ExpoRoot
    in RCTView (created by View)
    in View (created by AppContainer)
    in DevAppContainer (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer

错误类别2

代码语言:javascript
运行
复制
Error: Text strings must be rendered within a <Text> component.

This error is located at:
    in div
    in div
    in span
    in Unknown
    in div (created by FormGroup)
    in FormGroup (created by App)
    in form (created by Form)
    in Form (created by App)
    in RCTView (created by View)
    in View (created by App)
    in App (created by ExpoRoot)
    in ExpoRoot
    in RCTView (created by View)
    in View (created by AppContainer)
    in DevAppContainer (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer

这是我的密码,谢谢!

代码语言:javascript
运行
复制
import React from 'react';

import Amplify from 'aws-amplify';
import config from './src/aws-exports';

import { Text, View } from 'react-native';
import { Button, Form } from 'react-bootstrap';
import RangeSlider from 'react-bootstrap-range-slider';

Amplify.configure(config)

class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      mood: 1,
      sleep: 3,
      energy: 3,
      clarity: 5,
      social: 2,
      notes: ""
    };
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleSubmit() {
    console.log("submitted state:", this.state);
  }

  render() {
    return(
      <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
        <Form>
          <Form.Group>
            <Text>Mood</Text>
              <RangeSlider
                value={this.state.mood}
                onChange={(e) => this.setState({mood: e.target.value})}
                min={1}
                max={5}/>
            <Text>Sleep</Text>
              <RangeSlider
                value={this.state.sleep}
                onChange={(e) => this.setState({sleep: e.target.value})}
                min={1}
                max={5}/>
            <Text>Energy</Text>
              <RangeSlider
                value={this.state.energy}
                onChange={(e) => this.setState({energy: e.target.value})}
                min={1}
                max={5}/>
            <Text>Clarity</Text>
              <RangeSlider
                value={this.state.clarity}
                onChange={(e) => this.setState({clarity: e.target.value})}
                min={1}
                max={5}/>
            <Text>Social</Text>
              <RangeSlider
                value={this.state.social}
                onChange={(e) => this.setState({social: e.target.value})}
                min={1}
                max={5}/>
            <Text>Check-in Notes</Text>
              <Form.Control 
                as="textarea"
                rows={3}
                value={this.state.notes}
                onChange={(e) => this.setState({notes: e.target.value})}/>
          </Form.Group>
        </Form>
        <Button onClick={this.handleSubmit}>Submit</Button>
      </View>
    );
  }
}

export default App;
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70303597

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档