[英]How to install react-native-vector-icons?
I literally tried all the resources I could find 我确实尝试了所有可以找到的资源
This , This , and so many other questions on stack overflow here but I'm not able to get it to work 这 , 这 ,和许多其他的堆栈溢出的问题在这里,但我无法得到它的工作
I first used the 我先用了
react-native init myapp
Command to start a project and install the react-native-vector-icons as instructed on its github page 命令启动项目并按照其github页面上的说明安装react-native-vector-icons
I have imported the FontAwesome family like this 我已经像这样导入了FontAwesome家族
import Icon from 'react-native-vector-icons/FontAwesome';
But when ever i run the app I get this error on both android and ios 但是当我运行应用程序时,我在android和ios上都收到此错误
On Android 在Android上
The development server returned response error code: 500
URL: http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false
Body:
{"type":"InternalError","errors":[],"message":"Metro Bundler has encountered an internal error, please check your terminal error output for more details"}
processBundleResult
BundleDownloader.java:242
access$100
BundleDownloader.java:41
onResponse
BundleDownloader.java:208
execute
RealCall.java:135
run
NamedRunnable.java:32
runWorker
ThreadPoolExecutor.java:1112
run
ThreadPoolExecutor.java:587
run
Thread.java:818
On iOS 在iOS上
Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(Metro Bundler has encountered an internal error, please check your terminal error output for more details (null))
__38-[RCTCxxBridge loadSource:onProgress:]_block_invoke.242
RCTCxxBridge.mm:419
___ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE_block_invoke.118
__80-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]_block_invoke
-[RCTMultipartStreamReader emitChunk:headers:callback:done:]
-[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:]
-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]
__88-[NSURLSession delegate_streamTask:didBecomeInputStream:outputStream:completionHandler:]_block_invoke
__NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__
-[NSBlockOperation main]
-[__NSOperationInternal _start:]
_dispatch_client_callout
_dispatch_block_invoke_direct
_dispatch_client_callout
_dispatch_block_invoke_direct
dispatch_block_perform
__NSOQSchedule_f
_dispatch_client_callout
_dispatch_continuation_pop
_dispatch_async_redirect_invoke
_dispatch_root_queue_drain
_dispatch_worker_thread3
_pthread_wqthread
start_wqthread
And on the debugging console I get this errors 在调试控制台上,我得到了这个错误
deltaUrlToBlobUrl.js:31 GET http://localhost:8081/index.delta?platform=android&dev=true&minify=false 500 (Internal Server Error)
DeltaPatcher.js:58 Uncaught (in promise) Error: DeltaPatcher should receive a fresh Delta when being initialized
at DeltaPatcher.applyDelta (DeltaPatcher.js:58)
at deltaUrlToBlobUrl (deltaUrlToBlobUrl.js:34)
at <anonymous>
I'll be very glad if I could get it working. 如果我能使它工作,我将非常高兴。 Thanks in advance.
提前致谢。
I finally found the solution 我终于找到了解决方案
This happens only in the react-native version 0.52.0 The file it is trying to find does in fact declare that module. 仅在本机版本0.52.0中会发生这种情况,实际上它尝试查找的文件确实声明了该模块。 Something about the order of file searching must have changed with the recent release.
关于文件搜索顺序的某些信息必须随最新版本而更改。
Try this 尝试这个
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json
Use npm you can install it in a easy way.Follow the below commonds in the root folder: 使用npm,您可以轻松地安装它。在根文件夹中遵循以下公共条件:
* npm install react-native-vector-icons
* react-native link
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.