小编Sim*_*emi的帖子

如何在 React Native run-android 中解决“您的项目中需要有 MainApplication”

我从世博会退出,并尝试 react-native run-android,出现此错误;

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\simil\OneDrive\Documents\Codes\react-native\expo\doc\node_modules\react-native-unimodules\gradle.groovy' line: 81

* What went wrong:
A problem occurred evaluating project ':app'.
> You need to have MainApplication in your project

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s
Run Code Online (Sandbox Code Playgroud)

这是我的 MainActivity 路径

MyApp \android\app\src\main\java\com\com.example.eg\MainActivity.java

javascript java android react-native

8
推荐指数
2
解决办法
3254
查看次数

如何将猫鼬模式从唯一 true 更改为唯一 false

在下面的代码中,注释的电子邮件架构是以前的,我不再希望电子邮件是必需的,并且是唯一的,它应该是可选的。

我收到一条错误,说重复,为空“E11000重复键错误集合:mydb.lists索引:email_1 dup键:(电子邮件:null)”

const mongoose = require("mongoose");    
const { Schema } = mongoose;

const alliedSchema = new Schema(
  {
    name: String,
    phone: String,
    email: {
        unique: false,
        type: String
    },
    // email:{
    // type: String,
    // unique: true,
    // required: true,
    // lowercase: true,
    // validate(value){
    //     if(!validator.isEmail(value)){
    //         throw new Error('Email is invalid')
    //     }
    // }
    // },
    picture: {
      type: String,
      default: "https://www.dialadocdirect.org/app/storage/images/noimage.jpg",
    },
    location: String,
    type: String,
    verified: {
      type: Boolean,
      default: false,
    },
  },
  { …
Run Code Online (Sandbox Code Playgroud)

mongoose node.js mongoose-schema

3
推荐指数
1
解决办法
2025
查看次数

React Native 平面列表为不匹配条件的项目留下空白空间

示例图片

第一行显示一张卡片,这是因为假设存在的项目与所述条件不匹配。但我想删除这个空格,并将当前位于下一行的下一张卡放在那里。

{state.data ? <FlatList
                data={state.data}

                renderItem={({ item }) => {
                    console.log(item)
                    return (
                        <View style={{ justifyContent: 'space-evenly', marginHorizontal: 0 }}>
                           <View>

                                {item.available == 1 ?
                                    <TouchableOpacity activeOpacity={.8} onPress={() => navigation.navigate('Appointment', { id: item.id, name: item.name, phone: item.phone, email: item.email, session: item.session, player_id: item.player_id, picture: item.picture })} >
                                        <Card style={{ width: width / 2.05, alignItems: 'center', justifyContent: 'center', borderRadius: 15, paddingTop: 10, height: height / 2.4 }}>
                                            <CardItem cardBody>
                                                <Image
                                                    source={{ uri: 'http://example.com/storage/' + item.picture }}
                                                    style={{ height: 200, width: null, …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-flatlist

0
推荐指数
1
解决办法
1637
查看次数