Giter Site home page Giter Site logo

wuba / taro-mortgage-calculator Goto Github PK

View Code? Open in Web Editor NEW
349.0 25.0 79.0 14.46 MB

首个 Taro 3 多端统一实例 - 支持 React Native,Weapp,H5。

Home Page: https://wuba.github.io/Taro-Mortgage-Calculator

License: MIT License

JavaScript 2.81% TypeScript 80.45% SCSS 16.17% HTML 0.56%
taro react-native react miniprogram taro3 wechat wechat-mini-program wechat-app react-native-app cross-platform

taro-mortgage-calculator's Issues

扫码后报错TypeError: undefined is not an object (evaluating '_expoModulesCore.NativeModulesProxy.ExpoUpdates')

ERROR TypeError: undefined is not an object (evaluating '_expoModulesCore.NativeModulesProxy.ExpoUpdates')
LOG Running "taroDemo" with {"rootTag":11}
ERROR Invariant Violation: "taroDemo" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called.

启动后模拟器错误

image

发现Taro-Mortgage-Calculator 后端有下面错误

Error: Unable to resolve module `./index` from ``: 

None of these files exist:
  * index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
  * index/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
    at ModuleResolver.resolveDependency (/Volumes/CodeFile/小程序/Taro-Mortgage-Calculator/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:163:15)
    at ResolutionRequest.resolveDependency (/Volumes/CodeFile/小程序/Taro-Mortgage-Calculator/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/Volumes/CodeFile/小程序/Taro-Mortgage-Calculator/node_modules/metro/src/node-haste/DependencyGraph.js:287:16)
    at /Volumes/CodeFile/小程序/Taro-Mortgage-Calculator/node_modules/metro/src/lib/transformHelpers.js:267:42
    at Server.<anonymous> (/Volumes/CodeFile/小程序/Taro-Mortgage-Calculator/node_modules/metro/src/Server.js:841:41)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Volumes/CodeFile/小程序/Taro-Mortgage-Calculator/node_modules/metro/src/Server.js:99:24)
    at _next (/Volumes/CodeFile/小程序/Taro-Mortgage-Calculator/node_modules/metro/src/Server.js:119:9)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)


#BUG#demo不能跑起来

根据readme最后终端执行没有报错,如下:


$ taro build --type rn --platform android --watch --port 8081
👽 Taro v3.2.0-canary.5

Tips: 预览模式生成的文件较大,设置 NODE_ENV 为 production 可以开启压缩。
Example:
$ NODE_ENV=production taro build --type rn --watch


  #####   ##   #####   ####     #####  ######   ##    ####  #####    #    #   ##   ##### # #    # ######
    #    #  #  #    # #    #    #    # #       #  #  #    #   #      ##   #  #  #    #   # #    # #
    #   #    # #    # #    #    #    # #####  #    # #        #      # #  # #    #   #   # #    # #####
    #   ###### #####  #    #    #####  #      ###### #        #      #  # # ######   #   # #    # #
    #   #    # #   #  #    #    #   #  #      #    # #    #   #      #   ## #    #   #   #  #  #  #
    #   #    # #    #  ####     #    # ###### #    #  ####    #      #    # #    #   #   #   ##   ######

React-Native Dev server is running on port: 8081


To reload the app press "r"
To open developer menu press "d"
                 Welcome to React Native!
                Learn once, write anywhere

但是浏览器访问127.0.0.1:8081 提示:GET http://127.0.0.1:8081/ 404 (Not Found)

跟预期的完全不一致呀,请问这是什么问题,我看了下编译后的文件:

➜  dist git:(master) tree
.
└── rn
    └── ios
        ├── assets
        │   ├── node_modules
        │   │   ├── @react-navigation
        │   │   │   └── stack
        │   │   │       └── lib
        │   │   │           └── commonjs
        │   │   │               └── views
        │   │   │                   └── assets
        │   │   │                       ├── back-icon-mask.png
        │   │   │                       ├── back-icon.png
        │   │   │                       ├── [email protected]
        │   │   │                       └── [email protected]
        │   │   └── @tarojs
        │   │       ├── components-rn
        │   │       │   └── dist
        │   │       │       └── assets
        │   │       │           ├── loading-warn.png
        │   │       │           ├── loading.png
        │   │       │           └── video
        │   │       │               └── play.png
        │   │       └── taro-rn
        │   │           └── dist
        │   │               └── lib
        │   │                   ├── scanCode
        │   │                   │   ├── icon_close.png
        │   │                   │   └── icon_pic.png
        │   │                   └── showModal
        │   │                       └── success.png
        │   └── src
        │       └── assets
        │           └── images
        │               ├── comm_form_icon_gouxuan.png
        │               ├── comm_form_icon_weigouxuan.png
        │               ├── esf_calculator_icon_close.png
        │               ├── esf_calculator_icon_question.png
        │               ├── esf_calculator_img_bggradient.png
        │               ├── esf_calculator_img_building.png
        │               ├── esf_calculator_img_mark.png
        │               ├── esf_calculator_img_percent.png
        │               ├── yz_prop_icon_arrow.png
        │               └── yz_prop_icon_arrow_white.png
        └── main.jsbundle

使用 taro-native-shell 加载bundle,报错

启动的时候报错 React Refresh runtime should not be included in the production bundle

如何解决,谢谢

shell用的0.64.0的版本

// 运行的是这条命令
"ios": "react-native run-ios",

详细报错内容

[Thu May 13 2021 14:12:51.391]  BUNDLE  ./index 

[Thu May 13 2021 14:13:01.430]  ERROR    Error: React Refresh runtime should not be included in the production bundle.
[Thu May 13 2021 14:13:01.440]  ERROR    Error: Requiring module "node_modules/react-native/Libraries/Core/InitializeCore.js", which threw an exception: Error: React Refresh runtime should not be included in the production bundle.
[Thu May 13 2021 14:13:01.450]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
[Thu May 13 2021 14:13:02.300]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

基于 Taro 开发的三端组件,UT怎么做同构

现在基于 taro 平台解析以及其他的多端能力, 写了一个组件库,组件库能适配三端,但是 UT 不知道怎么写适合 ,主要有两个问题

  1. 用的 jest + react-testing-library , 主要 RN 端需要用 @testing-library/react-native , 在小程序/h5端 又需要 用 @testing-library/react

  2. 组件库本身是依赖 Taro的平台解析文件的能力, 将端的差异处理拆解到不同的文件,而 jest 本身也没有这块按平台解析的的能力

现在想求教你们多端同构的项目是怎么写UT的啊?

代码跑不起来

node版本:v16.20.1
taro cli版本:Taro v3.5.7
执行yarn安装依赖,报:
[2/4] 🚚 Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.20.1"
error Found incompatible module.
根据错误提示把node版本切换为v18.17.1后重新安装依赖,安装成功,执行yarn run dev:h5,报:
Snipaste_2024-03-20_22-18-36

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.