react-native-beacons-manager icon indicating copy to clipboard operation
react-native-beacons-manager copied to clipboard

Compatibility with React Native 0.60

Open RafaelFeiten opened this issue 4 years ago • 15 comments

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?

RafaelFeiten avatar Aug 22 '19 02:08 RafaelFeiten

same issue,

yoojeen126 avatar Aug 30 '19 07:08 yoojeen126

did you fix it?

wasa4587 avatar Sep 09 '19 17:09 wasa4587

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

RafaelFeiten avatar Sep 09 '19 18:09 RafaelFeiten

@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

wasa4587 avatar Sep 09 '19 20:09 wasa4587

@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.

yoojeen126 avatar Sep 23 '19 08:09 yoojeen126

@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!

niv-breez avatar Oct 29 '19 14:10 niv-breez

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?

rnnyrk avatar Nov 04 '19 11:11 rnnyrk

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 avatar Nov 05 '19 07:11 niv-breez

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

niv-breez avatar Nov 13 '19 15:11 niv-breez

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.

ptsteadman avatar Nov 13 '19 16:11 ptsteadman

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

rnnyrk avatar Nov 13 '19 19:11 rnnyrk

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!

junhoyeo avatar Nov 16 '19 02:11 junhoyeo

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.

niv-breez avatar Nov 16 '19 06:11 niv-breez

Any chance of getting an updated version on NPM?

RM-Eric avatar Jan 30 '20 19:01 RM-Eric

@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);
				}}
			/>

sankar9659 avatar Feb 12 '20 10:02 sankar9659