如何使用 create-react-native-app Metro bundler 进行配置

问题描述

我是 react-native 的新手,这个社区很棒。

但是我在使用 https://github.com/terrylinla/react-native-sketch-canvas 配置 npx create-react-native-app 时遇到问题。

到目前为止我所做的只是编辑 metro.config.js

const extraNodeModules = {
  '@terrylinla/react-native-sketch-canvas': './node_modules/@terrylinla\react-native-sketch-canvas/'
}

const resolverMainFields = ['browser','main'];

module.exports = {
  resolver: {
    extraNodeModules,resolverMainFields
  },transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,inlineRequires: false,},}),};

然后 cmd react-native run-android 它正确捆绑,但从未加载到模拟器上:

这是它在shell中所说的:


info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:8712) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
Jetifier found 987 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...

Configure project :terrylinla_react-native-sketch-canvas
WARNING: Configuration 'provided' is obsolete and has been replaced with 'compileOnly'.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
<============-> 99% EXECUTING [10m 30s]
IDLE
IDLE
:app:installDebug
IDLE

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)