1.0.3 • Published 10 years ago

react-native-make-review-modal v1.0.3

Weekly downloads
5
License
ISC
Repository
github
Last release
10 years ago

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.