尝试使用react-native进行发布构建,会失败吗?

时间:2015-08-03 07:02:08

标签: javascript ios reactjs react-native

我想知道为什么react-native build在发布方案中失败并且在调试方案中工作正常?

我正在使用react-native-side-menureact-native-navbar。这是代码。

'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  Navigator,
  ScrollView,
  TouchableHighlight,
  AlertIOS,
} = React;

var Fluxxor = require('fluxxor');

var flux = require('./flux');

var SideMenu = require('react-native-side-menu');

var MainStyles = require('./styles/main');

var NavigationBarView = React.createClass({
  render: function() {
    return (
      <View>
        <Text style={{ fontSize: 36 }}>Hello World</Text>
        <Text style={{ fontSize: 36 }}>Hello World</Text>
        <Text style={{ fontSize: 36 }}>Hello World</Text>
        <Text style={{ fontSize: 36 }}>Hello World</Text>
      </View>
    );
  }
});

var Menu = React.createClass({
  about: function() {
    this.props.menuActions.close();
  },

  render: function() {
    return (
      <View>
        <Text>Menu</Text>
        <Text onPress={this.about}>About</Text>
      </View>
    );
  }
});

// Navigation with Content View
var Docit = React.createClass({

  renderScene: function(route, navigator) {
    var Component = route.component;
    var navBar = route.navigationBar;

    if (navBar) {
      navBar = React.addons.cloneWithProps(navBar, {
        navigator: navigator,
        route: route
      });
    }

    var menu = <Menu/>;

    return (
      <SideMenu menu={menu} touchToClose={true} animation='spring' onChange={(isOpen) => { console.log('isOpen: ',isOpen); } }>
      <View style={MainStyles.navigator}>
        {navBar}
        <View style={MainStyles.container}>
        <Component menu={menu} navigator={navigator} route={route} flux={flux} {...route.passProps} />
        </View>
      </View>
      </SideMenu>
    );
  },

  render: function() {
    return (
      <Navigator
        style={MainStyles.navigator}
        renderScene={this.renderScene}
        initialRoute={{
          component: NavigationBarView,
        }}
        configureScene={() => {
          return Navigator.SceneConfigs.FloatFromRight;
        }}
      />
    );
  }
});

AppRegistry.registerComponent('Docit', () => Docit);

代码也使用main.js模块,它只是基本的,你可以摆脱它。正如您在Navigator中可以看出的那样,当前逻辑将sidemenu包裹在renderScene中。我不知道为什么它在release版本上显示空白屏幕。它在debug方案中运行良好。

0 个答案:

没有答案