Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3 from 35d/feature/#2-improve-example
Browse files Browse the repository at this point in the history
Feature/#2 improve example
  • Loading branch information
35d authored Jul 8, 2019
2 parents beec873 + 97d9274 commit 3b6db3d
Show file tree
Hide file tree
Showing 58 changed files with 12,286 additions and 3,000 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
⚠️ This library is in development

# react-native-half-modal

![react-native-half-modal](https://github.com/nikke1925/react-native-half-modal/blob/master/half-modal.gif)
Expand Down Expand Up @@ -61,7 +59,7 @@ For a more complex example take a look at the `./example/App.js`

# Todo

- [ ] Android Support
- [x] Android Support
- [x] Create Example App
- [x] Write Readme
- [x] Props list
Expand Down
3 changes: 0 additions & 3 deletions example/.babelrc

This file was deleted.

6 changes: 0 additions & 6 deletions example/.buckconfig

This file was deleted.

70 changes: 0 additions & 70 deletions example/.flowconfig

This file was deleted.

1 change: 0 additions & 1 deletion example/.gitattributes

This file was deleted.

66 changes: 10 additions & 56 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,56 +1,10 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
*.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots

# Bundle artifact
*.jsbundle
node_modules/**/*
.expo/*
npm-debug.*
*.jks
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
web-report/
2 changes: 1 addition & 1 deletion example/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
68 changes: 29 additions & 39 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,62 @@ import SemiModal from './SemiModal';

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#151F2B',
flex: 1
},
open: {
textAlign: 'center',
marginTop: 64
},
modalText: {
color: '#FFF',
color: '#FFF'
},
modalCancelButton: {
borderRadius: 32,
height: 40,
backgroundColor: '#243347',
justifyContent: 'center',
alignItems: 'center',
alignItems: 'center'
},
bar: {
width: 16,
borderBottomWidth: 4,
borderColor: '#FFFFFF44',
borderColor: '#FFFFFF44'
},
leftBar: {
borderRadius: 16,
borderTopRightRadius: 0,
borderBottomRightRadius: 0,
borderBottomRightRadius: 0
},
rightBar: {
borderRadius: 16,
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0,
borderBottomLeftRadius: 0
},
SemiModal: {
paddingVertical: 24,
paddingHorizontal: 24,
paddingTop: 8,
backgroundColor: '#151F2B'
},
modalInner: {
flex: 1,
flexDirection: 'row',
marginBottom: 24,
justifyContent: 'center'
}
});

type State = {
isVisible: boolean,
isVisible: boolean
};

type Props = {};

export default class App extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
isVisible: false,
isVisible: false
};
}

Expand All @@ -61,34 +77,13 @@ export default class App extends Component<Props, State> {
return (
<View style={styles.container}>
<View style={{ paddingVertical: 32 }}>
<Text
style={{ color: '#FFF', textAlign: 'center', marginTop: 64 }}
onPress={() => {
this.modalOpen();
}}
>
<Text style={styles.open} onPress={this.modalOpen}>
OPEN
</Text>
</View>
<SemiModal
isVisible={this.state.isVisible}
onModalClose={() => this.modalClose()}
style={{
paddingVertical: 24,
paddingHorizontal: 24,
paddingTop: 8,
backgroundColor: '#151F2B',
}}
>
<SemiModal isVisible={this.state.isVisible} onModalClose={this.modalClose} style={styles.SemiModal}>
<View>
<View
style={{
flex: 1,
flexDirection: 'row',
marginBottom: 24,
justifyContent: 'center',
}}
>
<View style={styles.modalInner}>
<View style={[styles.bar, styles.leftBar]} />
<View style={[styles.bar, styles.rightBar]} />
</View>
Expand All @@ -98,12 +93,7 @@ export default class App extends Component<Props, State> {
<Text style={[styles.modalText, { marginBottom: 16 }]}>Block</Text>
<Text style={[styles.modalText, { marginBottom: 16 }]}>Report</Text>
</View>
<TouchableOpacity
onPress={() => {
this.modalClose();
}}
style={styles.modalCancelArea}
>
<TouchableOpacity onPress={this.modalClose} style={styles.modalCancelArea}>
<View style={styles.modalCancelButton}>
<Text style={[styles.modalText]}>Cancel</Text>
</View>
Expand Down
11 changes: 9 additions & 2 deletions example/SemiModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,22 @@ export default class SemiModal extends Component<Props, State> {
styles.modalBackground,
{ transform: this.state.modalBgPan.getTranslateTransform() },
{ backgroundColor: this.props.backgroundColor },
{ justifyContent: 'flex-end' },
]}
>
<TouchableWithoutFeedback onPress={() => this.props.onModalClose()}>
<TouchableWithoutFeedback
style={[
styles.modalBackground,
{ transform: this.state.modalBgPan.getTranslateTransform() },
{ backgroundColor: this.props.backgroundColor },
]}
onPress={() => this.props.onModalClose()}
>
<View style={{ height: Dimensions.get('window').height }} />
</TouchableWithoutFeedback>
<Animated.View
style={[
styles.modal,
{ bottom: this.state.modalHeight },
{ transform: this.state.modalPan.getTranslateTransform() },
this.props.style,
]}
Expand Down
65 changes: 0 additions & 65 deletions example/android/app/BUCK

This file was deleted.

Loading

0 comments on commit 3b6db3d

Please sign in to comment.