MacKentoch / react-native-beacons-manager

React-Native library for detecting beacons (iOS and Android)
MIT License
579 stars 319 forks source link

Compatibility with React Native 0.60 #148

Open RafaelFeiten opened 5 years ago

RafaelFeiten commented 5 years ago

Version

1.0.7

Platform

iOS

OS version

iOS 13

Steps to reproduce

  1. yarn add react-native-beacons-manager
  2. react-native link react-native-beacons-manager
  3. ...others steps on iOS to background mode...

Expected behavior

Works

Actual behavior

iOS give me the error:

fatal error: 'React/RCTBridge.h' file not found

"react": "16.8.6", "react-native": "0.60.4", "react-native-beacons-manager": "^1.0.7"

Someone can help me?

yoojeen126 commented 5 years ago

same issue,

wasa4587 commented 5 years ago

did you fix it?

RafaelFeiten commented 5 years ago

Nothing at moment bro... using RN 59 and waiting for updates.

wasa4587 commented 5 years ago

@RafaelFeiten @yoojeen126 This is how I made it works Selected Libraries/RNiBeacon.xcodeproj then on TARGETS select RNiBeacon, look for Header Search Paths and I added these paths

$(SRCROOT)/../../../../ios/Pods/Headers/Public/React-Core $(SRCROOT)/../../../react-native/ReactCommon

Both are recursive

Screen Shot 2020-01-13 at 11 49 35

yoojeen126 commented 4 years ago

@RafaelFeiten @wasa4587 I tried downgrade RN 0.43.3 version like this example version, then woked fine. I think its maybe RN version compatibility problem with beacon manager.

niv-breez commented 4 years ago

@wasa4587 thank you, your suggestion worked! One of my mistake is that i added the lines in the search header debug and search header release not the father, i don't know if it is really related but its working. thanks!

rnnyrk commented 4 years ago

Anyone has a suggestion on how to fix this? I've installed the library and linked it manually by running react-native link react-native-beacons-manager

I've also edited my react-native.config.js to exclude them from pod install.

module.exports = {
  project: {
    ios: {},
    android: {},
  },
  assets: ['./src/app/static/fonts/'],
  dependencies: {
    'react-native-beacons-manager': {
      platforms: {
        android: null,
        ios: null,
      },
    },
    'react-native-bluetooth-state': {
      platforms: {
        android: null,
        ios: null,
      },
    },
  },
};

Tried @wasa4587 his solution, but unfortunately I still get an error when running the build in dev mode;

Screenshot 2019-11-04 at 12 13 31

Running the latest version of RN. Anyone any idea?

niv-breez commented 4 years ago

You have a missing line in this list (which was there before I added the two lines @wasa4587 suggested).

This is a screenshot of how it should look like: WhatsApp Image 2019-11-05 at 9 46 28 AM

niv-breez commented 4 years ago

@rnnyrk did it worked to you? I have facing a similar issue (now it's limits.h file not found) when trying to archive

ptsteadman commented 4 years ago

The lastest version on npm doesn't have support for autolink, but the source on GitHub does, see:

https://github.com/MacKentoch/react-native-beacons-manager/issues/149#issuecomment-553488736

This way you will not require xcode manual configuration.

rnnyrk commented 4 years ago

@niv-breez I did indeed fix it by using the version from Github instead of npm

junhoyeo commented 4 years ago

I faced the same issue, fixed it by using @ptsteadman 's solution. Used react-native-bluetooth-status as an alternative for react-native-bluetooth-state, which was also breaking!

niv-breez commented 4 years ago

Hi everyone, My fix above not really fix the problem, the build failes again when archiving. We checked @ptsteadman solution to use the GitHub version instead the npm version and the library compiles perfectly but the beacons don't really work. I don't get events enter/exit to my app, as mentioned in one of the issues here.

So the solution we choose, which fixes everything the build+the beacons, is:

  1. copy react-native-beacons-manager.podspec file into node_modules/react-native-beacons-manager
  2. go to the ios directory, and run pod install
  3. remove libRNiBeacon from 'Frameworks, Libraries, and Embedded Content' in xcode under "General" in breez_app build settings

.podspec file: require 'json' package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) Pod::Spec.new do |s| s.name = package['name'] s.version = package['version'] s.summary = package['description'] s.license = package['license'] s.authors = package['author'] s.homepage = package['homepage'] s.platform = :ios, "9.0" s.source = { :git => "https://github.com/MacKentoch/react-native-beacons-manager.git", :tag => "v#{s.version}" } s.source_files = "ios/**/*.{h,m}" s.dependency 'React' end Notes: You can also create a fork instead doing it every time It's a temporary solution until @MacKentoch will release a stable version to npm.

RM-Eric commented 4 years ago

Any chance of getting an updated version on NPM?

sankar9659 commented 4 years ago

@ptsteadman yeah its working, there is no issue but beacons are not detecting. here is my code:

startBeacon = () => { // Alert.alert('','StartBeacon function') Reactotron.log('startBeacon function'); if (Platform.OS === 'ios') { Alert.alert('','IOS platform funtion') Reactotron.log('iosPLatform'); const region = { identifier: 'REGION1', uuid: '' }; DeviceEventEmitter.addListener('beaconsDidRange', (data) => { Alert.alert('','beacons monitering started') if (data.beacons.length) { this.setState({ detectedBeacons: data.beacons }); Alert.alert(Found beacons!, JSON.stringify(data.beacons)); } });

        Beacons.startUpdatingLocation();
    }
    else{   
    Reactotron.log('else');
    Beacons.detectIBeacons();
    Beacons.detectAltBeacons();
    Beacons.detectEstimotes();
    Beacons.detectEddystoneUID();
    Beacons.detectEddystoneTLM();
    Beacons.detectEddystoneURL();
    Beacons.startRangingBeaconsInRegion('REGION1')
        .then((data) => {
            Alert.alert('', `Beacons monitoring started!`);
        })
        .catch((error) => {
            Alert.alert('', `Beacons start error!`);
        });
    DeviceEventEmitter.addListener('beaconsDidRange', (data) => {
        if (data.beacons.length) {
            this.setState({ detectedBeacons: data.beacons });
            Alert.alert(`Found beacons!`, JSON.stringify(data.beacons));
        }
    });
    }
};

render() {
    const { nearbyStores } = this.state;
    const { beaconList } = this.props;

    return (
        <View>
            <NavigationEvents
                onWillFocus={() => {
                    StatusBar.setBarStyle('light-content', true);
                    if (beaconList.length) {
                        this.startBeacon();
                    }
                }}
                onWillBlur={() => {
                    if (beaconList.length) {
                        Beacons.stopRangingBeaconsInRegion('REGION1')
                            .then(() => {
                                Alert.alert('', `Beacons monitoring stopped succesfully!`);
                            })
                            .catch((error) => {
                                Alert.alert(`Beacons stop error!`);
                            });
                    }
                    StatusBar.setBarStyle('dark-content', true);
                }}
            />