GithubHelp home page GithubHelp logo

thundersdata-frontend / rn-template Goto Github PK

View Code? Open in Web Editor NEW
83.0 83.0 33.0 20.5 MB

雷数前端react native项目模版

License: Apache License 2.0

JavaScript 51.40% TypeScript 41.21% Java 4.16% Ruby 1.20% Objective-C 1.39% Shell 0.19% Swift 0.02% Objective-C++ 0.42%

rn-template's People

Contributors

chj-damon avatar dependabot[bot] avatar sunshineh2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rn-template's Issues

IOS真機調試出錯 "您好像忘记使用Portal.Host包裹您的应用了。建议您使用ThemeProvider,它内置了Portal.Host"

@chj-damon

在Simulator上是沒有這個問題的, 可以正常運行。

但xcode build 在真機測試就出現這個問題

Model: Iphone SE 2
OS: 15.6.1

image

package.json

{
  "name": "rn-template",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "android:dev": "ENVFILE=.env.dev react-native run-android",
    "android:staging": "cd ./android && ENVFILE=.env.staging ./gradlew app:assembleRelease",
    "android:prod": "cd ./android && ENVFILE=.env.prod ./gradlew app:assembleRelease",
    "ios": "react-native run-ios",
    "start": "watchman watch-del-all && react-native start --reset-cache",
    "eslint": "eslint --fix --ext .ts,.tsx src/",
    "prettier": "prettier --check src/**/*.tsx --write",
    "clean": "react-native-clean-project",
    "postinstall": "npx husky install && npx patch-package",
    "commit": "git-cz",
    "tsc": "tsc -p tsconfig.json",
    "pod": "cd ios && pod install && cd ..",
    "test": "jest --passWithNoTests --detectOpenHandles --watch"
  },
  "config": {
    "commitizen": {
      "path": "node_modules/cz-customizable"
    }
  },
  "lint-staged": {
    "src/**/*.{js,ts,tsx}": [
      "npm run eslint",
      "npm run prettier"
    ]
  },
  "dependencies": {
    "@byron-react-native/refresh-control": "^1.1.2",
    "@react-native-clipboard/clipboard": "^1.10.0",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/netinfo": "^8.3.0",
    "@react-native-picker/picker": "^2.4.1",
    "@react-navigation/bottom-tabs": "^6.3.1",
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/stack": "^6.2.1",
    "@shopify/restyle": "2.0.0",
    "@td-design/react-native": "^4.0.2",
    "@td-design/react-native-calendar": "^2.3.9",
    "@td-design/react-native-echarts": "^5.3.0",
    "@td-design/react-native-image-picker": "^1.6.0",
    "@td-design/react-native-picker": "^1.10.2",
    "@td-design/react-native-tabs": "^3.2.1",
    "@td-design/rn-hooks": "^2.2.7",
    "dayjs": "^1.10.7",
    "immer": "^9.0.12",
    "jotai": "^1.6.0",
    "jotai-modular": "^1.3.1",
    "lodash-es": "^4.17.21",
    "rc-field-form": "^1.22.0",
    "react": "^17.0.2",
    "react-error-boundary": "^3.1.4",
    "react-native": "^0.66.3",
    "react-native-background-timer": "^2.4.1",
    "react-native-bootsplash": "^4.1.3",
    "react-native-config": "^1.4.5",
    "react-native-exception-handler": "^2.10.10",
    "react-native-fast-image": "^8.5.11",
    "react-native-gesture-handler": "^2.4.2",
    "react-native-image-picker": "^4.8.1",
    "react-native-image-resizer": "^1.4.5",
    "react-native-mmkv": "^2.1.0",
    "react-native-pager-view": "^6.1.2",
    "react-native-reanimated": "^2.4.1",
    "react-native-redash": "^16.2.3",
    "react-native-restart": "0.0.24",
    "react-native-safe-area-context": "^4.2.2",
    "react-native-screens": "^3.12.0",
    "react-native-svg": "^12.1.1",
    "react-native-tab-view": "^3.3.4",
    "react-native-webp-format": "^1.1.2",
    "react-native-webview": "^11.26.0",
    "recyclerlistview": "^3.0.5",
    "recyclerlistview-masonrylayoutmanager": "^3.0.14",
    "rn-fetch-blob": "^0.12.0",
    "umi-request": "^1.4.0"
  },
  "devDependencies": {
    "@babel/core": "^7.17.5",
    "@babel/runtime": "^7.17.2",
    "@bam.tech/react-native-make": "^3.0.3",
    "@commitlint/cli": "^16.2.1",
    "@commitlint/config-conventional": "^16.2.1",
    "@react-native-community/eslint-config": "^3.0.1",
    "@react-navigation/devtools": "^6.0.4",
    "@td-design/pont-engine": "1.0.3",
    "@td-design/svgicon-cli": "^1.5.1",
    "@testing-library/react-hooks": "^7.0.2",
    "@types/jest": "^27.0.3",
    "@types/lodash": "^4.14.178",
    "@types/lodash-es": "^4.17.5",
    "@types/react-native": "^0.66.16",
    "@typescript-eslint/eslint-plugin": "^5.12.1",
    "@typescript-eslint/parser": "^5.12.1",
    "babel-jest": "^27.5.1",
    "babel-plugin-import": "^1.13.3",
    "babel-plugin-module-resolver": "^4.1.0",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "commitizen": "^4.2.3",
    "cz-customizable": "^6.3.0",
    "eslint": "^8.9.0",
    "eslint-config-prettier": "^8.4.0",
    "eslint-import-resolver-typescript": "^2.5.0",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-react": "^7.29.4",
    "eslint-plugin-react-hooks": "^4.3.0",
    "eslint-plugin-react-native": "4.0.0",
    "eslint-plugin-replace-hooks": "^1.0.3",
    "husky": "^7.0.4",
    "inquirer": "^8.2.0",
    "jest": "^27.5.1",
    "lint-staged": "^12.3.4",
    "lorem-ipsum": "^2.0.4",
    "metro-react-native-babel-preset": "^0.66.2",
    "npm-run-all": "^4.1.5",
    "patch-package": "^6.4.7",
    "prettier": "^2.5.0",
    "react-native-clean-project": "^4.0.0",
    "react-native-flipper": "^0.128.4",
    "react-test-renderer": "^17.0.2",
    "shelljs": "^0.8.5",
    "ts-jest": "^27.1.3",
    "typescript": "4.5.4"
  }
}

不用swagger怎么前后端怎么做联调?另外"我的"页面报错了

后台没用swagger, 应该怎么做联调

/**
 * @description login
 */
import * as defs from '../../baseClass';
import { initRequest } from '../../../../common';
import Config from 'react-native-config';

const backEndUrl = Config['authorization'];

// 初始值
export const init = new defs.authorization.ClientConfig();
// 接口地址
export const url = '/auth/login';

export async function fetch(params = {}) {
  const request = await initRequest();
  const result = await request.get(backEndUrl + url, {
    headers: {
      'Content-Type': 'application/json',
    },
    params,
  });
  return result;
}

ByronRefreshControl并没有声明和导出

截屏2022-07-22 下午10 47 16

单纯的ReactNative,不用expo,有项目模版吗?

@chj-damon
我是初学者,想有个简单的环境来运行雷数ui
只自用react-native,不用expo,有这样的项目模板吗?
我现在的环境基本上都是最新的
react-native:0.72.4
react: 18.2.0
Java: 11.0.20
Node: 18
Npm: 9.6.7
如果没有模版,该怎么做?

安卓中运行本地图片和网络图片的示例,图片全是空白

@chj-damon
项目是克隆下来的0.7.2的
安卓中下面2个图片示例,expo-image图片无法显示,是空白的
但是在ios中是正常的
src/modules/homepage/screens/pictures/demo1.tsx
src/modules/homepage/screens/pictures/demo2.tsx
不知道该怎么能解决
另外:
我把图片组件换成react-native-fast-image,在安卓和ios中都可以正常加载本地和远程图片
Screenshot_20230917_113242_com rntemplate
Screenshot_20230917_113248_com rntemplate

魅族手机切换导航方式再激活应用会卡住黑屏无响应

机型:魅族16th plus
系统版本:Flyme 8.1.5.1A
安卓版本:8.1.0

操作步骤:

  1. 使用 vscode 跑起应用
  2. 在手机打开应用后,按home键回到系统主页
  3. 前往系统设置将导航方式从 mBack 切换到 安卓导航栏
  4. 回到系统主页,再次打开应用
  5. 控制台就会出现报错信息,应用卡死黑屏无响应(如果没有出现就返回系统首页再次打开应用)

下面是控制台 log 的信息:
LOG Skipping setJSExceptionHandler: Reason: In DEV mode and allowedInDevMode = false
LOG Running "rnTemplate" with {"rootTag":1}
LOG java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rntemplate/com.rntemplate.MainActivity}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.ScreenFragment: calling Fragment constructor caused an exception
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2983)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3061)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4968)
at android.app.ActivityThread.-wrap19(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1753)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:192)
at android.app.ActivityThread.main(ActivityThread.java:6842)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
Caused by: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.ScreenFragment: calling Fragment constructor caused an exception
at androidx.fragment.app.Fragment.instantiate(Fragment.java:631)
at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
at androidx.fragment.app.FragmentManager$3.instantiate(FragmentManager.java:483)
at androidx.fragment.app.FragmentStateManager.(FragmentStateManager.java:85)
at androidx.fragment.app.FragmentManager.restoreSaveState(FragmentManager.java:2728)
at androidx.fragment.app.FragmentController.restoreSaveState(FragmentController.java:198)
at androidx.fragment.app.FragmentActivity$2.onContextAvailable(FragmentActivity.java:149)
at androidx.activity.contextaware.ContextAwareHelper.dispatchOnContextAvailable(ContextAwareHelper.java:99)
at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:297)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:273)
at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:45)
at com.rntemplate.MainActivity.onCreate(MainActivity.java:42)
at android.app.Activity.performCreate(Activity.java:7065)
at android.app.Activity.performCreate(Activity.java:7056)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1216)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2931)
... 10 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at androidx.fragment.app.Fragment.instantiate(Fragment.java:613)
... 25 more
Caused by: java.lang.IllegalStateException: Screen fragments should never be restored. Follow instructions from software-mansion/react-native-screens#17 (comment) to properly configure your main activity.
at com.swmansion.rnscreens.ScreenFragment.(ScreenFragment.kt:42)
... 28 more

升级计划

  • 简化鲁能项目的版本作为APP开发模板
  • 添加设计规范对应的页面作为演示demo

运行失败

image
路径明明是存在的,为啥会显示不存在,导致运行不起来

克隆项目到本地,安装依赖后运行 yarn android:dev 报错

环境: Mac OS 12.0.1

yarn run v1.22.10
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1397 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...

Configure project :app
Reading env from: .env

Task :react-native-image-picker:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
212 actionable tasks: 2 executed, 210 up-to-date

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-image-picker:compileDebugJavaWithJavac'.

Could not resolve all files for configuration ':react-native-image-picker:debugCompileClasspath'.
Could not download annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/annotation/annotation/1.1.0/annotation-1.1.0.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/androidx/annotation/annotation/1.1.0/annotation-1.1.0.jar'.
> dl.google.com:443 failed to respond

  • 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 12s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-image-picker:compileDebugJavaWithJavac'.

Could not resolve all files for configuration ':react-native-image-picker:debugCompileClasspath'.
Could not download annotation-1.1.0.jar (androidx.annotation:annotation:1.1.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/androidx/annotation/annotation/1.1.0/annotation-1.1.0.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/androidx/annotation/annotation/1.1.0/annotation-1.1.0.jar'.
> dl.google.com:443 failed to respond

  • 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 12s

建议添加widnows下rn-template模板启动说明

启动时window会报'ENVFILE'不是内部或外部命令, 需要在package.json中设置

$ ENVFILE=.env.staging react-native run-ios           # bash
$ SET ENVFILE=.env.staging && react-native run-ios    # windows
$ env:ENVFILE=".env.staging"; react-native run-ios    # powershell

忘考虑!!!

readme撰写

新的模板集成了很多常用的功能,如热更新、消息推送、支付、sentry等。需要在readme里面按照实际项目进行改造的点都记录下来。

热更新

大佬,我集成了热更新,ios 可用。安卓调用update_check 时,接口报了304., 方便指导下我吗。 有偿

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.