无法读取未定义的 react-native 的 属性 'setNativeProps'
Cannot read property 'setNativeProps' of undefined react-native
我用过 react-native-drawer 。我将侧边菜单文件单独保存,并将其导入到主文件中。我想在侧面菜单文件中编写点击功能。当我单击第一个项目时,它给了我这个错误。
我怎么能解决这个问题我认为它的模拟子组件错误。
这是我的侧边菜单文件代码
import React, { Component } from 'react';
import {
View,
StyleSheet,TouchableHighlight
} from 'react-native';
import { Content,Text,List, ListItem .
,Header,Icon,Left,Right,Body,Button,Title} from 'native-base';
import StatusComponent from './StatusComponent';
import Hr from 'react-native-hr';
export default class SideBar extends Component{
constructor(props){
super(props);
console.log(props)
asad=this.asad.bind(this);
}
asad(){
alert('gata rhe ');
}
render(){
return(
<View style={{backgroundColor:'#262626',flex:1,
position:'relative' ,top:62}} >
<List>
<ListItem >
<Right>
<TouchableHighlight onPress={()=>this.asad(this.props)}>
<Text style={{color:'white'}} > main page</Text>
</TouchableHighlight>
</Right>
</ListItem>
<ListItem >
<Right>
<TouchableHighlight >
<Text style={{color:'white'}} > secnd page</Text>
</TouchableHighlight>
</Right>
</ListItem>
</List>
</View>
)
};
}
我得到了使用 Native Base 的解决方案 ui 如此可触摸的东西在本机列表项中不起作用,所以我像这样使用本机 BAse 的按钮
<ListItem Button onPress={() => this.asad(this.props) } >
<Right>
<Text style={{color:'white'}} > page</Text>
</Right>
</ListItem>
NativeBase 提供帮助以在我们的应用程序中包含 Drawer
我用过 react-native-drawer 。我将侧边菜单文件单独保存,并将其导入到主文件中。我想在侧面菜单文件中编写点击功能。当我单击第一个项目时,它给了我这个错误。
我怎么能解决这个问题我认为它的模拟子组件错误。 这是我的侧边菜单文件代码
import React, { Component } from 'react';
import {
View,
StyleSheet,TouchableHighlight
} from 'react-native';
import { Content,Text,List, ListItem .
,Header,Icon,Left,Right,Body,Button,Title} from 'native-base';
import StatusComponent from './StatusComponent';
import Hr from 'react-native-hr';
export default class SideBar extends Component{
constructor(props){
super(props);
console.log(props)
asad=this.asad.bind(this);
}
asad(){
alert('gata rhe ');
}
render(){
return(
<View style={{backgroundColor:'#262626',flex:1,
position:'relative' ,top:62}} >
<List>
<ListItem >
<Right>
<TouchableHighlight onPress={()=>this.asad(this.props)}>
<Text style={{color:'white'}} > main page</Text>
</TouchableHighlight>
</Right>
</ListItem>
<ListItem >
<Right>
<TouchableHighlight >
<Text style={{color:'white'}} > secnd page</Text>
</TouchableHighlight>
</Right>
</ListItem>
</List>
</View>
)
};
}
我得到了使用 Native Base 的解决方案 ui 如此可触摸的东西在本机列表项中不起作用,所以我像这样使用本机 BAse 的按钮
<ListItem Button onPress={() => this.asad(this.props) } >
<Right>
<Text style={{color:'white'}} > page</Text>
</Right>
</ListItem>
NativeBase 提供帮助以在我们的应用程序中包含 Drawer