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
Android React Native Project-使用本机基日期选择器会引发不变的冲突错误_Android_Reactjs_React Native_Native Base - Fatal编程技术网

Android React Native Project-使用本机基日期选择器会引发不变的冲突错误

Android React Native Project-使用本机基日期选择器会引发不变的冲突错误,android,reactjs,react-native,native-base,Android,Reactjs,React Native,Native Base,因此,我主要使用React Native为我的应用程序创建一个注册表单,其中一些组件是从Native Base导入的。不过,其中一个组件的渲染似乎不正确,给了我一个不变的冲突错误 我不知道为什么,不知道这里是否有人能解释发生了什么 当我删除DatePicker时,组件呈现得很好……但是在包含DatePicker的情况下,错误表示要检查组件的导出方式,这对我来说没有意义 下面是我的代码,用于该特定屏幕。我不认为我需要补充任何东西,但如果需要,请让我知道 import { View, Text, T

因此,我主要使用React Native为我的应用程序创建一个注册表单,其中一些组件是从Native Base导入的。不过,其中一个组件的渲染似乎不正确,给了我一个不变的冲突错误

我不知道为什么,不知道这里是否有人能解释发生了什么

当我删除DatePicker时,组件呈现得很好……但是在包含DatePicker的情况下,错误表示要检查组件的导出方式,这对我来说没有意义

下面是我的代码,用于该特定屏幕。我不认为我需要补充任何东西,但如果需要,请让我知道

import { View, Text, TextInput } from 'react-native';
import { Button, Card, CardItem, Form, Item, Label, Input, DatePicker } from 'native-base';
import { emailChanged, passwordChanged } from '../actions';
import Icon from 'react-native-vector-icons/Ionicons';

class PersInfoScreen extends React.Component {
  onEmailChange(text) {
    this.props.emailChanged(text);
  }

  onPasswordChange(text) {
    this.props.passwordChanged(text);
  }



  render() {
    return (
      <View style={{ backgroundColor: '#03A9F4', flex: 1 }}>
        <Text style={{ color: '#fff' }}>Signup below to start raising money for charity everytime you run.</Text>
        <Form>
        <View style={styles.formBox}>
        <DatePicker
          defaultDate={new Date(2018, 4, 4)}
          minimumDate={new Date(2018, 1, 1)}
          maximumDate={new Date(2018, 12, 31)}
          locale={"en"}
          timeZoneOffsetInMinutes={undefined}
          modalTransparent={false}
          animationType={"fade"}
          androidMode={"default"}
          placeHolderText="Select date"
          textStyle={{ color: "green" }}
          placeHolderTextStyle={{ color: "#d3d3d3" }}
          />
            <Item stackedLabel style={{ margin: 8 }}>
              <Label style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>First Name:</Label>
              <Input />
            </Item>
            <Item stackedLabel style={{ margin: 8 }}>
              <Label style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Last Name:</Label>
              <Input />
            </Item>
            <Item stackedLabel style={{ margin: 8 }}>
              <Label style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Email:</Label>
              <Input />
            </Item>
            <Item stackedLabel style={{ margin: 8 }}>
              <Label style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Date Of Birth</Label>
              <Input />
            </Item>
            <Item stackedLabel style={{ margin: 8 }}>
              <Label style={{ color: '#fff', fontSize: 16, fontWeight: 'bold', paddingBottom: 5 }}>Gender:</Label>
              <View style={{ flex: 1, flexDirection: 'row', margin: 10, alignItems: 'center', justifyContent: 'center' }}>
                <Icon style={styles.iconStyles} name="ios-man" size={36} color="white"/><Text>Man</Text>
                <Icon style={styles.iconStyles} name="ios-woman" size={36} color="white"/><Text>Woman</Text>
              </View>
            </Item>
            <Button><Text>Next</Text></Button>
          </View>
        </Form>
      </View>
    )
  }
}

export default PersInfoScreen;

const styles = {
   iconStyles: {
     fontSize: 30,
     margin: 10
   },
   formBox: {
     margin: 20,
     borderWidth: 5,
     borderRadius: 10,
     borderColor: '#fff'
   }
 }

今天,本机Base(v2.4.3)也遇到了同样的问题

要解决此问题,必须将本机Base更新为v2.7或更高版本。 请注意,本机Base v2.7+需要React本机v0.56+,因此可能还需要更新RN本身(请参阅)

关于更新本机基址本身,非常简单,只需调整package.json中的版本号,删除node_模块:

rm -rf node_modules
然后运行新的安装

npm install or yarn install

之后,DatePicker组件的导入将正常工作。

据我所知,当某些组件被导入为未定义组件时,会出现此错误。因为您说如果您删除DatePicker,它正常工作,那么项、标签、输入和图标组件之一可能未定义。您可以对它们进行console.log并查看@如果删除其他组件时没有任何组件产生该错误,这难道不意味着datepicker是未定义的吗?我将如何记录这一点。。。。。在组件willmount(console.log(DatePicker))中?是。只是为了调试,您也可以在render@michalthankyou中对其进行控制台操作……我只是尝试了一下,结果把我的项目彻底搞砸了。我正在使用react native maps,它似乎只适用于55及更低版本……但巴别塔也存在问题。我将尝试创建一个新项目并从那里开始。
npm install or yarn install