Skip to content

[RN 0.25.1] _reactNative.DeviceEventEmitter.removeListener is not a function  #16811

Closed
@12343954

Description

@12343954

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: v8.2.1
Yarn: NO
npm: 5.5.1
Watchman: 4.9.0
Xcode: Version 8.3.3 (8E3004b)
Android Studio: NO

Packages: (wanted => installed)
react-native: 0.25.1
react: ^0.14.9

Target Platform: iOS (10.3)

Steps to Reproduce

(Write your steps here:)

componentDidMount() { //Alert.alert('xx',this.state.user.FName+' ') this.watchID = navigator.geolocation.watchPosition((position) => { var lastPosition = JSON.stringify(position); this.setState({ lastPosition }); }); console.log('this.watchID') console.log(this.watchID) }

**componentWillUnmount() { // here is the bug** navigator.geolocation.clearWatch(this.watchID); }

  1. when unmount , appear this error
    _reactNative.DeviceEventEmitter.removeListener is not a function

Expected Behavior

I don't want upgrade RN to other version,because it will occur lots of error,that's too bad!

(Write what you thought would happen.)

I do catch error,but can't catch the error

componentWillUnmount() {
		try {
			navigator.geolocation.clearWatch(this.watchID);
			debugger;
		} catch (error) {
			console.log(error)
		}
		// debugger;
	}

(Write what happened. Add screenshots!)
image

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions