Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/RNDrawerExample/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ export default class App extends Component {
drawerDisabled: false,
};
closeDrawer = () => {
this._drawer.close()
this.setState({drawerOpen: false})
};
openDrawer = () => {
this._drawer.open()
this.setState({drawerOpen: true})
};
render() {
return (
<Drawer
ref={(ref) => this._drawer = ref}
type="static"
content={
<ControlPanel closeDrawer={this.closeDrawer} />
}
acceptDoubleTap
styles={{main: {shadowColor: '#000000', shadowOpacity: 0.3, shadowRadius: 15}}}
open={this.state.drawerOpen}
onOpen={() => {
console.log('onopen')
this.setState({drawerOpen: true})
Expand All @@ -51,7 +51,7 @@ export default class App extends Component {
panOpenMask={0.2}
negotiatePan
>
<Main />
<Main openDrawer={this.openDrawer} />
</Drawer>
)
}
Expand Down
2 changes: 1 addition & 1 deletion examples/RNDrawerExample/src/ControlPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, {
} from 'react-native'

export default class ControlPanel extends Component {
static propTypes = {
static PropTypes = {
closeDrawer: PropTypes.func.isRequired
};

Expand Down
7 changes: 3 additions & 4 deletions examples/RNDrawerExample/src/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ import React, {
} from 'react-native'

export default class ControlPanel extends Component {

static contextTypes = {
drawer: PropTypes.object.isRequired,
static PropTypes = {
openDrawer: PropTypes.func.isRequired,
};

render() {
return (
<ScrollView style={styles.container}>
<Text>MAIN</Text>
<TouchableOpacity style={styles.button} onPress={this.context.drawer.open}>
<TouchableOpacity style={styles.button} onPress={ this.props.openDrawer }>
<Text>Open Drawer</Text>
</TouchableOpacity>

Expand Down