Skip to content

Commit

Permalink
Removes portal.js
Browse files Browse the repository at this point in the history
  • Loading branch information
rajkissu committed May 22, 2016
1 parent 630ca47 commit 33d5839
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.idea
npm-debug.log

# vim
*.sw*
43 changes: 12 additions & 31 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ import styles from './style';
import BaseComponent from './BaseComponent';
import rebound from 'rebound';

let tag;
let componentIndex = 0;
const Portal = require('react-native/Libraries/Portal/Portal.js');

const propTypes = {
data: PropTypes.array,
Expand Down Expand Up @@ -68,7 +66,7 @@ export default class ModalPicker extends BaseComponent {
);

this.state = {
animated: true,
animationType: 'slide',
modalVisible: false,
transparent: false,
selected: 'please select',
Expand All @@ -87,23 +85,15 @@ export default class ModalPicker extends BaseComponent {
}

close() {
if (Platform.OS == 'android') {
Portal.closeModal(tag);
} else {
this.setState({
modalVisible: false
});
}
this.setState({
modalVisible: false
});
}

open() {
if (Platform.OS == 'android') {
Portal.showModal(tag, this.renderOptionList());
} else {
this.setState({
modalVisible: true
});
}
this.setState({
modalVisible: true
});
}

renderSection(section) {
Expand Down Expand Up @@ -164,22 +154,13 @@ export default class ModalPicker extends BaseComponent {
);
}

componentWillMount() {
if (Platform.OS === 'android')
tag = Portal.allocateTag();
}

render() {

let dp = null;
if (Platform.OS == 'android') {

} else {
dp = (
<Modal transparent={true} ref="modal" visible={this.state.modalVisible} animated={this.state.animated}>
{this.renderOptionList()}
</Modal>);
}
const dp = (
<Modal transparent={true} ref="modal" visible={this.state.modalVisible} onRequestClose={this.close} animationType={this.state.animationType}>
{this.renderOptionList()}
</Modal>
);

return (
<View style={this.props.style}>
Expand Down

0 comments on commit 33d5839

Please sign in to comment.