使用NavigatorIOS时无法显示内容

时间:2018-08-19 15:55:51

标签: reactjs react-native navigator-ios

我是本机新手,正在构建一个简单的测试应用程序。

代码-

import React, { Component } from 'react';
import { NavigatorIOS, Text, View } from 'react-native';

export default class App extends Component {
  render() {
    return (
      <NavigatorIOS
        initialRoute={{
          component: StartingPage,
          title: 'Test App',
        }}
        style={styles.container}
      />
    );
  }
}

class StartingPage extends Component {
  render() {
    return (<Text>Some thing to be displayed here</Text>)
  }
}
const styles={
  container:{
    felx:1
  }
}

问题: [应用程序希望将具有简单标题的组件呈现为“ Test App”,而某些文本则不具有。

应用程序以简单的标题呈现,但没有文本。 还尝试将以下属性赋予文本组件,但没有任何积极结果。

textDescription:{
fontSize:18,
textAlign:'center',
color:'#656565',
marginTop:65,
}

任何帮助将不胜感激。

谢谢!

1 个答案:

答案 0 :(得分:0)

在react native中,所有Text组件都必须位于View组件之内。

尝试:

var x = wait({interval:28,callback:function(){
    if(this.frame === 99){
        console.log(this.lastInvoked - this.startTime);
        window.cancelAnimationFrame(this.cancelFrame);
    }
}}) //logs something around 2800