Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用NavigatorIOS react native时屏幕左侧不可触摸_Ios_React Native - Fatal编程技术网

使用NavigatorIOS react native时屏幕左侧不可触摸

使用NavigatorIOS react native时屏幕左侧不可触摸,ios,react-native,Ios,React Native,当我使用NavigatorIOS时,我的react原生iOS应用程序上有一个非常奇怪的bug(需要它):屏幕左侧有一个30点区域,第一次触摸时无法触摸(在touchable highlight或touchable无反馈时不会发生任何事情)例如,在Listview元素中 当我使用Navigator时,一点问题都没有,它是针对NavigatorIOS的(我在应用程序的这一部分中需要它),也尝试过,没有任何风格,同样的问题 没有看到任何github问题或关于此bug的讨论 编辑: 可运行示例: 组件代

当我使用
NavigatorIOS
时,我的react原生
iOS
应用程序上有一个非常奇怪的bug(需要它):屏幕左侧有一个30点区域,第一次触摸时无法触摸(在
touchable highlight
touchable无反馈时不会发生任何事情)例如,在
Listview
元素中

当我使用Navigator时,一点问题都没有,它是针对NavigatorIOS的(我在应用程序的这一部分中需要它),也尝试过,没有任何风格,同样的问题

没有看到任何github问题或关于此bug的讨论

编辑:

可运行示例:

组件代码示例:

'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  NavigatorIOS,
  ListView,
  TouchableWithoutFeedback,
  Dimensions,
} = React;

var myListView = React.createClass({
  getInitialState: function() {
    return {
        ds: new ListView.DataSource({
                rowHasChanged: (row1, row2) => row1 !== row2,
            }),
        };
    },

  componentDidMount: function() {
    console.log('feed datasource');
    this.setState({
      ds: this.state.ds.cloneWithRows([{name: 'one'}, {name:'two'}, {name: 'three'}]),
    });
  },

  render: function() {
    return (
            <View style={styles.container}>
                <ListView 
                    dataSource={this.state.ds}
                    renderRow={this.renderItem}
                    style={styles.listView}
                />
        <TouchableWithoutFeedback onPress={this.nextroute}>
            <View style={[styles.pressme, {flex:1}]}>
                <Text>Next route to see the issue</Text>
                </View>
        </TouchableWithoutFeedback>
            </View>
        );
    },

  renderItem: function(item) {
    return (
            <View style={styles.row}>   
          <TouchableWithoutFeedback onPress={() => alert('pressed')}>
            <View style={styles.pressme}>
                <Text>x</Text>
                </View>
        </TouchableWithoutFeedback>
        <Text>{item.name} - Item description...</Text>
      </View>
    );
  },

  nextroute: function() {
    this.props.navigator.push({
            title: 'Try press [x] (twice)',
            component: myListView,
            onLeftButtonPress: () => this.props.navigator.pop(),
        });
  },

});

var SampleApp = React.createClass({
  render: function() {
    return (
            <NavigatorIOS
                style={styles.navcontainer}
                initialRoute={{
                    component: myListView,
                    title: 'First view is ok', 
                }}
                tintColor="#000000"
                barTintColor="#fd7672"
                translucent={false}
                ref='navios'
            />
    );
  }
});

var styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 28,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    fontSize: 19,
    marginBottom: 5,
  },
  navcontainer: {
        flex: 1,
    },
  listView: {
    flex: 1,
    width: Dimensions.get('window').width,
  },
  row: {
        flex: 1,
        flexDirection: 'row',
        justifyContent: 'flex-start',
        alignItems: 'center',
        backgroundColor: '#FFFFFF',
    },
  pressme: {
    margin: 10,
    borderWidth: 1,
    borderColor: 'red',
    padding: 15,
  }
});

AppRegistry.registerComponent('SampleApp', () => SampleApp);
“严格使用”;
var React=require('React-native');
变量{
评估学,
样式表,
文本,
看法
航海家,
ListView,
可触摸且无反馈,
尺寸,
}=反应;
var myListView=React.createClass({
getInitialState:函数(){
返回{
ds:新建ListView.DataSource({
行已更改:(行1,行2)=>行1!==行2,
}),
};
},
componentDidMount:function(){
log('feed datasource');
这是我的国家({
ds:this.state.ds.cloneWithRows([{name:'one'},{name:'two'},{name:'three'}]),
});
},
render:function(){
返回(
看问题的下一个途径
);
},
renderItem:函数(项){
返回(
警报('pressed')}>
x
{item.name}-项目说明。。。
);
},
nextroute:function(){
这个是.props.navigator.push({
标题:“尝试按[x](两次)”,
组件:myListView,
onLeftButtonPress:()=>this.props.navigator.pop(),
});
},
});
var SampleApp=React.createClass({
render:function(){
返回(
);
}
});
var styles=StyleSheet.create({
容器:{
弹性:1,
为内容辩护:“中心”,
对齐项目:“居中”,
背景颜色:“#F5FCFF”,
},
欢迎:{
尺寸:28,
textAlign:'中心',
差额:10,
},
说明:{
textAlign:'中心',
颜色:'#333333',
尺码:19,
marginBottom:5,
},
导航集装箱:{
弹性:1,
},
列表视图:{
弹性:1,
宽度:尺寸。获取('窗口')。宽度,
},
行:{
弹性:1,
flexDirection:'行',
justifyContent:“flex start”,
对齐项目:“居中”,
背景颜色:“#FFFFFF”,
},
按一下:{
差额:10,
边框宽度:1,
边框颜色:“红色”,
填充:15,
}
});
AppRegistry.registerComponent('SampleApp',()=>SampleApp);

打开github问题:你能在rnplay.org上创建一个可运行的示例吗?那将大有帮助!当然,这里有一个可运行的示例:注意:问题只发生在设备上,在模拟器上没有问题……我在使用tcomb form native时遇到过类似的问题。当升级到react native 0.28(从0.20升级到0.28)时,问题就消失了。