无法使用本机日历

时间:2019-08-19 10:27:30

标签: react-native react-native-calendars

  

错误:捆绑失败:错误:无法解析<section id="register" class="mb-5 mt-5"> <div class="container" style="width: 100%;"> <div class="row"> <div class="col-xs-12 col-sm-6 col-md-4 mx-auto"> <div class="card_register"> <div class="card"> <div class="card-body text-center"> <form #formRegister="ngForm" (ngSubmit)="onAddUser()"> <h1 class="h3 mb-3 font-weight-normal">Register</h1> <div class="alert alert-danger" role="alert" *ngIf="isError"> {{msgError}} </div> <div class="form-group"> <input type="email" name="email" class="form-control" placeholder="Email" [(ngModel)]="email" required minlength="8"> </div> <div class="alert alert-danger" role="alert" *ngIf="email['touched'] && !email['valid']"> <div *ngIf="email.errors.required">Email is required</div> <div *ngIf="email.errors.minlength">Email must be at least 8 characters</div> </div> <div class="form-group"> <input type="password" name="password" class="form-control" placeholder="Password" [(ngModel)]="password" required minlength="5" maxlength="10"> </div> <div class="alert alert-danger" role="alert" *ngIf="password['touched'] && !password['valid']"> <div *ngIf="password.errors.required">Password is required</div> <div *ngIf="password.errors.minlength">Password must be at least 5 characters</div> </div> <hr> <div class="form-group" style="width: auto"> <h5>Selectionner image:</h5> <input type="file" accept=".png, .jpg" (change)="onUpload($event)"> </div> <div class="progress"> <div [style.visibility]="(uploadPercent == [0]) ? 'hidden' : 'visible'" class="progress-bar progress-bar-striped bg-success" role="progressbar" [style.width]="(uploadPercent | async) +'%'"> <!-- <span class="progressText" *ngIf="urlImage | async"> Ok!!</span> --> </div> </div> <br> <input #imageUser type="hidden" [value]="urlImage | async"> <button *ngIf="urlImage | async; else btnDisabled" type="submit" class="btn btn-lg btn-primary btn-block">Register</button> <ng-template #btnDisabled> <button type="submit" disabled=true class="btn btn-lg btn-secondary btn-block">Register</button> </ng-template> <div class="form-group"> <a routerLink="/user/login" class="form-control login-user">Do you have account?</a> </div> <div class="form-group"> <button class="btn btn-block btn-social btn-facebook" (click)="onLoginFacebook()"> <!-- <span class="fa fa-facebook"></span> --> FACEBOOK </button> <button class="btn btn-block btn-social btn-google" (click)="onLoginGoogle()"> <!-- <span class="fa fa-google"></span> --> GOOGLE </button> </div> </form> </div> </div> </div> </div> </div> </div> </section> 中的模块hoist-non-react-statics :急速模块图中不存在模块E:\DEVELOPMENTWORKSPACE\test\node_modules\react-native-calendars\src\expandableCalendar\asCalendarConsumer.js

这可能与https://github.com/facebook/react-native/issues/4968

有关

要解决此问题,请尝试以下操作:

  1. 清晰的守望者手表:hoist-non-react-statics
  2. 删除watchman watch-del-all文件夹:node_modules
  3. 重置Metro Bundler缓存:rm -rf node_modules && npm installrm -rf /tmp/metro-bundler-cache-*
  4. 删除急速缓存:npm start -- --reset-cache

1 个答案:

答案 0 :(得分:1)

问题是src / expandableCalendar / asCalendarConsumer.js试图导入未在package.json中声明为依赖项的“ hoist-non-react-statics” 因此,解决方案是将其添加到package.json中,如下所示:

"dependencies": {
"lodash": "^4.0.0",
"prop-types": "^15.5.10",
"xdate": "^0.8.0",
"hoist-non-react-statics": "*"},

比运行npm install运行react-native run-ios快了!