[问题] 传出ViewController.view显示不正常

楼主: duckscorpion (歆)   2018-03-01 18:53:10
使用React-native导出原生GameVC的View给JS使用
GameVC已在StoryBroad上使用Autolayout排成满版
但遇到问题是run了之后 有时候会跑版
不晓得是什么地方有问题?
试过直接修改frame = Screem.bounds也无作用
下面是我的code
请大大帮忙解答
//RNTGameManager.m
@interface RNTGameManager : RCTViewManager
@end
@implementation RNTGameManager
RCT_EXPORT_MODULE()
GameVC *vc;
- (UIView *)view {
UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main"
bundle:nil];
vc = [mystoryboard instantiateViewControllerWithIdentifier:@"StartVC"];
return vc.view;
}
// GameView.js
import ...
class GameView extends React.Component {
render() {
return <RNTGame {...this.props} />;
}
}
...
var RNTGame = requireNativeComponent('RNTGame', GameView);
module.exports = GameView;
//App.js
import GameView from "./GameView"
import ...
export default class App extends React.Component {
render() {
return (
<GameView style={{ flex: 1}}/>
);
}
...
}
作者: powerwolf543 (NixonShin)   2018-03-05 00:49:00
你这样每次拿的view会是不同instance

Links booklink

Contact Us: admin [ a t ] ucptt.com