Skip to content

djchie/react-native-make-review-modal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Native Make Review Modal Component

A React Native component for displaying a modal for making reviews. Compatible with both iOS and Android.

Table of Contents

  1. Usage
  2. Requirements
  3. Development
    1. Installing Dependencies
    2. Running the Scraper
    3. Handling UCI Data Changes
    4. Roadmap
  4. Contributing

Usage

Install the package via npm install react-native-make-review-modal --save. Then require it in your JavaScript file via require('react-native-make-review-modal'). Check out an example usage below:

var StarRating = require('react-native-star-rating');

if (Platform.OS === 'android'){
  var Portal = require('react-native/Libraries/Portal/Portal');
  var tag;
}

var ExampleComponent = React.createClass({
  getInitialState: function () {
    return {
      isReviewModalOpen: false,
    };
  },
  componentWillMount: function() {
    if( Platform.OS === 'android' ) {
      tag = Portal.allocateTag();
    }
  },
  onMakeReviewButtonPress: function () {
    if (Platform.OS === 'android') {
      Portal.showModal(tag, <MakeReviewModalView
        visible={this.state.isReviewModalOpen}
        isOpen={this.state.isReviewModalOpen}
        onSubmitReview={this.submitReview}
        onCloseReviewButtonPress={this.onCloseReviewButtonPress}
        titleText={'Test Modal'}
      />);
    }
    if (Platform.OS === 'ios') {
      this.setState({isReviewModalOpen: true});
    }
  },
  onCloseReviewButtonPress: function () {
    if (Platform.OS === 'android') {
      Portal.closeModal(tag);
    }
    if (Platform.OS === 'ios') {
      this.setState({isReviewModalOpen: false});
    }
  },
  submitReview: function (rating, review) {
    console.log('Submitting rating:' + rating + ', and review:' + review);
    this.onCloseReviewButtonPress();
  },
  render() {
    return (
      <MakeReviewModalView
        visible={this.state.isReviewModalOpen}
        isOpen={this.state.isReviewModalOpen}
        onSubmitReview={this.submitReview}
        onCloseReviewButtonPress={this.onCloseReviewButtonPress}
        titleText={'Test Modal'}
      />
    );
  }
});

module.exports = ExampleComponent;

Requirements

  • Node

Development

Installation

npm install react-native-make-review-modal --save

Roadmap

View the project roadmap here

Contributing

See CONTRIBUTING.md for contribution guidelines.

About

A React Native component for displaying a modal for making reviews

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published