Skip to content

Check Network on Request#1

Merged
alburdette619 merged 1 commit into
masterfrom
bugfix/ios-isconnected-initial
Dec 30, 2017
Merged

Check Network on Request#1
alburdette619 merged 1 commit into
masterfrom
bugfix/ios-isconnected-initial

Conversation

@alburdette619

Copy link
Copy Markdown
Owner

This is fixing react#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 react#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