Skip to content

Conversation

alburdette619
Copy link
Owner

This is fixing facebook#8615. The problem was that, on initialization, the _connectionType variable was still set to its default value of RCTConnectionTypeUnknown. The exposed API method did nothing to determine this unless a subscription had be established and then the method would simply return the last reported value. Instead, the exposed oneshot API call now actually checks the connection status through the same methods as the subscription and updates RCTNetInfo’s values before returning.

In order to avoid reporting events without a subscription, a flag is set and unset on calls to start/stopObserving.

This is fixing react-native issue facebook#8615.  The problem was that on initialization the _connectionType variable was still set to its default value of RCTConnectionTypeUnknown.  The exposed API method did nothing to determine this unless a subscription had be established and then the method would simply return the last reported value.  Instead, the exposed oneshot API call now actually checks the connection status through the same methods as the subscription and updates RCTNetInfo’s values before returning.

In order to avoid reporting events without a subscription, a flag is set and unset on calls to startObserving and stopObserving.
@alburdette619 alburdette619 merged commit 7d2d551 into master Dec 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant