react-native-ueat
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

react-native-ueat

Installation

Install UEAT and it's dependencies:

yarn add react-native-ueat @react-native-community/async-storage react-native-device-info react-native-webview react-native-geolocation-service

react-native link @react-native-community/async-storage
react-native link react-native-device-info
react-native link react-native-webview

Follow the instructions to install react-native-geolocation-service

Usage

<UEATRestaurant />

Props:

  • apiKey (string): Your restaurant API key
  • isMarketplace (boolean): Is this restaurant a marketplace or a regular restaurant?
  • culture (string): Your user culture (possible values: fr-CA, en-CA, en-US, en-UK, es-ES)
  • renderLoading (ReactNode): Display a loading spinner while the page is loading
  • renderError ((retry) => ReactNode): Display an error message and a button to retry
  • onLeave (function): Go back to the application

Example

import React from 'react';
import {
  SafeAreaView,
  StatusBar,
  ActivityIndicator,
  StyleSheet,
  Text,
  TouchableHighlight
} from 'react-native';
import { UEATRestaurant } from 'react-native-ueat';

const App = () => {
  return (
    <React.Fragment>
      <StatusBar barStyle="dark-content" />
      <SafeAreaView style={styles.container}>
        <UEATRestaurant
          apiKey="489eece4-2b9d-45a7-8da4-219e7bc59d68"
          culture="fr-CA"
          renderLoading={<ActivityIndicator size="large" color="#000000" />}
          renderError={retry => (
            <React.Fragment>
              <Text>An error has occured while loading</Text>
              <TouchableHighlight style={styles.button} onPress={retry}>
                <Text>Retry</Text>
              </TouchableHighlight>
            </React.Fragment>
          )}
          onLeave={() => console.warn('GO BACK TO APP')}
        />
      </SafeAreaView>
    </React.Fragment>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1
  },
  button: {
    alignItems: 'center',
    backgroundColor: '#DDDDDD',
    padding: 10
  }
});

export default App;

Go see the full example.

Readme

Keywords

none

Package Sidebar

Install

npm i react-native-ueat

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

88.5 kB

Total Files

69

Last publish

Collaborators

  • exon