gpt4 book ai didi

ios - 无论如何,是否可以使用 React Native 向 TabBarIOS 呈现 native Controller ?

转载 作者:行者123 更新时间:2023-11-30 12:54:05 25 4
gpt4 key购买 nike

我想将 TabBarIOS 集成到 native 应用程序中。例如点击按钮后呈现给 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);

native 代码:

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'

感谢您的帮助!

最佳答案

看到它找不到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

关于ios - 无论如何,是否可以使用 React Native 向 TabBarIOS 呈现 native Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40627144/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com