无论如何要将本地控制器呈现给带有React Native的TabBarIOS?(Is there anyway to present a native controller to a TabBarIO

编程入门 行业动态 更新时间:2024-10-28 06:29:28
无论如何要将本地控制器呈现给带有React Native的TabBarIOS?(Is there anyway to present a native controller to a TabBarIOS with React Native?)

我想将TabBarIOS集成到本机App中。 比如点击一个按钮后呈现给TabBarIOS。 但是当我跑步时,它会被击碎。

index.ios.js中

'use strict'; import React from 'react'; import { AppRegistry, } from 'react-native'; import myTabBar from './ios/tab/MyTab.js' AppRegistry.registerComponent('myTabBar', () => myTabBar);

本地代码:

let rootView = RCTRootView( bundleURL: jsCodeLocation, moduleName: "myTabBar", initialProperties: nil, launchOptions: nil ) let vc = UIViewController() vc.view = rootView self.presentViewController(vc, animated: true, completion: nil)

错误:

2016-11-16 15:56:51.600 [info][tid:com.facebook.react.JavaScript] Running application "myTabBar" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF 2016-11-16 15:56:51.611 [warn][tid:com.facebook.react.JavaScript] Warning: Native component for "RCTImageView" does not exist 2016-11-16 15:56:51.611 [warn][tid:com.facebook.react.JavaScript] Warning: Native component for "RCTVirtualImage" does not exist 2016-11-16 15:56:51.738 swift-2048[5277:144989] -[RCTCustomScrollView refreshControl]: unrecognized selector sent to instance 0x7febe1099c00 2016-11-16 15:56:51.739 [error][tid:main][RCTUIManager.m:1100] Exception thrown while executing UI block: -[RCTCustomScrollView refreshControl]: unrecognized selector sent to instance 0x7febe1099c00 2016-11-16 15:56:51.758 swift-2048[5277:144989] -[RCTCustomScrollView refreshControl]: unrecognized selector sent to instance 0x7febe1099c00 2016-11-16 15:56:51.759 swift-2048[5277:144989] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RCTCustomScrollView refreshControl]: unrecognized selector sent to instance 0x7febe1099c00'

谢谢你的帮助!

I wanna integrate a TabBarIOS into native App. Such as presenting to a TabBarIOS after hit a button. But it crushed when I run.

In index.ios.js

'use strict'; import React from 'react'; import { AppRegistry, } from 'react-native'; import myTabBar from './ios/tab/MyTab.js' AppRegistry.registerComponent('myTabBar', () => myTabBar);

native code:

let rootView = RCTRootView( bundleURL: jsCodeLocation, moduleName: "myTabBar", initialProperties: nil, launchOptions: nil ) let vc = UIViewController() vc.view = rootView self.presentViewController(vc, animated: true, completion: nil)

the error:

2016-11-16 15:56:51.600 [info][tid:com.facebook.react.JavaScript] Running application "myTabBar" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF 2016-11-16 15:56:51.611 [warn][tid:com.facebook.react.JavaScript] Warning: Native component for "RCTImageView" does not exist 2016-11-16 15:56:51.611 [warn][tid:com.facebook.react.JavaScript] Warning: Native component for "RCTVirtualImage" does not exist 2016-11-16 15:56:51.738 swift-2048[5277:144989] -[RCTCustomScrollView refreshControl]: unrecognized selector sent to instance 0x7febe1099c00 2016-11-16 15:56:51.739 [error][tid:main][RCTUIManager.m:1100] Exception thrown while executing UI block: -[RCTCustomScrollView refreshControl]: unrecognized selector sent to instance 0x7febe1099c00 2016-11-16 15:56:51.758 swift-2048[5277:144989] -[RCTCustomScrollView refreshControl]: unrecognized selector sent to instance 0x7febe1099c00 2016-11-16 15:56:51.759 swift-2048[5277:144989] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RCTCustomScrollView refreshControl]: unrecognized selector sent to instance 0x7febe1099c00'

Thanks for your help!

最满意答案

看到它无法找到RCTImageView ,我猜你没有包含该库。

如果你使用CocoaPods,你会希望它包含RCTImage ,并且它看起来有点像:

platform :ios, '9.0' target 'YourApp' do use_frameworks! # React Native pod 'React', :path => 'node_modules/react-native', :subspecs => [ 'Core', 'RCTImage', ] end

Seeing that it can't find RCTImageView, I'm guessing you haven't included the library.

If you're using CocoaPods, you'll want it to include RCTImage, and have it look a little something like:

platform :ios, '9.0' target 'YourApp' do use_frameworks! # React Native pod 'React', :path => 'node_modules/react-native', :subspecs => [ 'Core', 'RCTImage', ] end

更多推荐

本文发布于:2023-07-16 06:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1124929.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:要将   控制器   无论如何   React   Native

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!