1
Facebookからデモコードをコピーして貼り付けましたが、initialRouteコンポーネントはレンダリングされません。同様の質問で示唆されているflex:1の設定のような回答は、私にとってはうまくいかなかった。任意のヒント?NavigatorIOSはinitialrouteをレンダリングしません
import React, { Component } from 'react';
import {
StyleSheet,
NavigatorIOS,
StatusBar,
AppRegistry,
View,
Text,
TouchableHighlight,
} from 'react-native';
import NativeThing from './components/ReactNative';
export default class ListsList extends Component {
render() {
return (
<NavigatorIOS
initialRoute={{
component: MyScene,
title: 'My Initial Scene',
}}
style={{flex: 1}}
/>
);
}
}
class MyScene extends Component {
_onForward =() => {
this.props.navigator.push({
title: 'Scene ' + nextIndex,
});
}
render() {
return (
<View>
<Text>Current Scene: { this.props.title }</Text>
<TouchableHighlight onPress={this._onForward}>
<Text>Tap me to load the next scene</Text>
</TouchableHighlight>
</View>
)
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
}
});
AppRegistry.registerComponent('ListsList',() => ListsList);
にプロパティ
translucent={ false }
を追加します。 '1'が、そのコード内であなたが実際にどのビューに' container'スタイルを適用することはありませんスニペット。そうしようとしましたか? –これはコードコピーで、ネイティブのドキュメントから貼り付けられています。私は 'flex:1'を運がないほとんどのコンポーネントに追加して遊んだ。 – zliz