-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
13,402 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"env": { | ||
"react-native/react-native": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"rules": { | ||
"semi": 2, | ||
"quotes": [2, "single", { "avoidEscape": true }], | ||
"react/jsx-uses-vars": 2, | ||
"react/react-in-jsx-scope": 2, | ||
"react/jsx-uses-react": 2 | ||
}, | ||
"parser": "babel-eslint", | ||
"plugins": ["react", "react-native"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,55 @@ | ||
import React from 'react'; | ||
import {Text, TouchableOpacity, View} from 'react-native'; | ||
import { Text, TouchableOpacity, View } from 'react-native'; | ||
import Modal from 'react-native-simple-modal'; | ||
|
||
export default class App extends React.Component { | ||
state = {open: false}; | ||
state = { open: false }; | ||
|
||
modalDidOpen = () => console.log('Modal did open.') | ||
modalDidOpen = () => console.log('Modal did open.'); | ||
|
||
modalDidClose = () => { | ||
this.setState({open: false}); | ||
this.setState({ open: false }); | ||
console.log('Modal did close.'); | ||
} | ||
}; | ||
|
||
moveUp = () => this.setState({offset: -100}) | ||
moveUp = () => this.setState({ offset: -100 }); | ||
|
||
resetPosition = () => this.setState({offset: 0}) | ||
resetPosition = () => this.setState({ offset: 0 }); | ||
|
||
openModal = () => this.setState({open: true}) | ||
openModal = () => this.setState({ open: true }); | ||
|
||
closeModal = () => this.setState({open: false}) | ||
closeModal = () => this.setState({ open: false }); | ||
|
||
render() { | ||
return ( | ||
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}> | ||
<TouchableOpacity onPress={this.openModal}> | ||
<Text>Open modal</Text> | ||
</TouchableOpacity> | ||
<Modal | ||
offset={this.state.offset} | ||
open={this.state.open} | ||
modalDidOpen={this.modalDidOpen} | ||
modalDidClose={this.modalDidClose} | ||
style={{alignItems: 'center'}}> | ||
<View style={{alignItems: 'center'}}> | ||
<Text style={{fontSize: 20, marginBottom: 10}}>Hello world!</Text> | ||
<TouchableOpacity | ||
style={{margin: 5}} | ||
onPress={this.moveUp}> | ||
<Text>Move modal up</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity | ||
style={{margin: 5}} | ||
onPress={this.resetPosition}> | ||
<Text>Reset modal position</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity | ||
style={{margin: 5}} | ||
onPress={this.closeModal}> | ||
<Text>Close modal</Text> | ||
</TouchableOpacity> | ||
</View> | ||
</Modal> | ||
</View> | ||
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}> | ||
<TouchableOpacity onPress={this.openModal}> | ||
<Text>Open modal</Text> | ||
</TouchableOpacity> | ||
<Modal | ||
offset={this.state.offset} | ||
open={this.state.open} | ||
modalDidOpen={this.modalDidOpen} | ||
modalDidClose={this.modalDidClose} | ||
style={{ alignItems: 'center' }} | ||
> | ||
<View style={{ alignItems: 'center' }}> | ||
<Text style={{ fontSize: 20, marginBottom: 10 }}>Hello world!</Text> | ||
<TouchableOpacity style={{ margin: 5 }} onPress={this.moveUp}> | ||
<Text>Move modal up</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity | ||
style={{ margin: 5 }} | ||
onPress={this.resetPosition} | ||
> | ||
<Text>Reset modal position</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity style={{ margin: 5 }} onPress={this.closeModal}> | ||
<Text>Close modal</Text> | ||
</TouchableOpacity> | ||
</View> | ||
</Modal> | ||
</View> | ||
); | ||
} | ||
} |
Oops, something went wrong.