you have to Use
심판 = {_ 서랍 => (this.drawer = _drawer)}
import React, { Component } from "react";
import {
Text,
View,
DrawerLayoutAndroid,
TouchableHighlight
} from "react-native";
export default class DrawerExample extends Component {
constructor() {
super();
this.openDrawer = this.openDrawer.bind(this);
}
openDrawer() {
this.drawer.openDrawer();
}
render() {
var navigationView = (
<View style={{ flex: 1, backgroundColor: "#fff" }}>
<Text style={{ margin: 10, fontSize: 15, textAlign: "left" }}>
I'm in the Drawer!
</Text>
</View>
);
return (
<DrawerLayoutAndroid
drawerWidth={300}
ref={_drawer => (this.drawer = _drawer)}
drawerPosition={DrawerLayoutAndroid.positions.Left}
renderNavigationView={() => navigationView}
>
<View style={{ flex: 1, alignItems: "center" }}>
<Text style={{ margin: 10, fontSize: 15, textAlign: "right" }}>
Hello
</Text>
<Text style={{ margin: 10, fontSize: 15, textAlign: "right" }}>
World!
</Text>
<TouchableHighlight onPress={this.openDrawer}>
<Text>{"Open Drawer"}</Text>
</TouchableHighlight>
</View>
</DrawerLayoutAndroid>
);
}
}
덕분에, 나는 알지 못했다 이미보기 내에서 정상적인 기능을 사용하여,하지만 난 당신에게 줄 것이다에서 어쨌든 다른 사람들을 도울 수 있기 때문에 어쨌든 진드기가 있습니다. –