alexkendall / react-native-bluetooth-cross-platform

Cross-Platform Bluetooth & WiFi React Native Module. Powered by underdark http://underdark.io/.
179 stars 35 forks source link

DO we need to import anything? How do I use this? #19

Open Younanator opened 7 years ago

Younanator commented 7 years ago
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Button, StyleSheet, TouchableOpacity, Text } from 'react-native';
**Must I import anything here?**

let BluetoothCP = require('react-native-bluetooth-cross-platform');

let BlueTooth = () =>
  <TouchableOpacity
    style={styles.buttons}
    onPress={() => BluetoothCP.advertise('BT')}
  >
    <Text>Connect To a Device</Text>
  </TouchableOpacity>;

export default BlueTooth;

Anything wrong with that? It doesn't work on the EXPO App. When the Button is pressed, it returns the error Undefined is not an object(evaluating "NativeManager.advertise")

harm-an commented 6 years ago

Same issue

earlvanze commented 6 years ago

In HomeScreen.js: ... render() { return (

  <View style={styles.container}>
    <ScrollView style={styles.container} contentContainerStyle={styles.contentContainer}>
    <Button
      onPress={() => { BluetoothCP.advertise('WIFI-BT'); }}
      title={"Connect to Device"}
    />