Skip to content

Commit

Permalink
[Android][iOS] @react-native-community/netinfo 9.3.10, react-native-p…
Browse files Browse the repository at this point in the history
…ager-view to 6.2.0 (expo#22892)
  • Loading branch information
douglowder authored Jun 15, 2023
1 parent 7014c5e commit 4442897
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ protected WritableMap createConnectivityEventMap(@Nullable final String requeste

// Add if WiFi is ON or OFF
if (NetInfoUtils.isAccessWifiStatePermissionGranted(getReactContext())) {
boolean isEnabled = mWifiManager.isWifiEnabled();
boolean isEnabled = false;
if (mWifiManager != null) {
isEnabled = mWifiManager.isWifiEnabled();
}
event.putBoolean("isWifiEnabled", isEnabled);
}

Expand Down Expand Up @@ -208,7 +211,7 @@ private WritableMap createDetailsMap(@Nonnull String detailsInterface) {
}
break;
case "wifi":
if (NetInfoUtils.isAccessWifiStatePermissionGranted(getReactContext())) {
if (NetInfoUtils.isAccessWifiStatePermissionGranted(getReactContext()) && mWifiManager != null) {
WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
if (wifiInfo != null) {
// Get the SSID
Expand Down
8 changes: 4 additions & 4 deletions apps/bare-expo/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,9 @@ PODS:
- React-jsinspector (0.72.0-rc.5)
- React-logger (0.72.0-rc.5):
- glog
- react-native-netinfo (9.3.7):
- react-native-netinfo (9.3.10):
- React-Core
- react-native-pager-view (6.1.2):
- react-native-pager-view (6.2.0):
- React-Core
- react-native-safe-area-context (4.5.0):
- RCT-Folly
Expand Down Expand Up @@ -1470,8 +1470,8 @@ SPEC CHECKSUMS:
React-jsiexecutor: 98c1b1c1e60e137703597e5c5025f2ce3e4700fe
React-jsinspector: 04038f19b6269374640d90371796f63d034d3542
React-logger: 4e8c28425ddc27abb6cde80eece89cc765da7d86
react-native-netinfo: 2517ad504b3d303e90d7a431b0fcaef76d207983
react-native-pager-view: 54bed894cecebe28cede54c01038d9d1e122de43
react-native-netinfo: ccbe1085dffd16592791d550189772e13bf479e2
react-native-pager-view: 0ccb8bf60e2ebd38b1f3669fa3650ecce81db2df
react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc
react-native-segmented-control: 06607462630512ff8eef652ec560e6235a30cc3e
react-native-slider: 33b8d190b59d4f67a541061bb91775d53d617d9d
Expand Down
4 changes: 2 additions & 2 deletions apps/bare-expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"@babel/runtime": "^7.20.0",
"@react-native-async-storage/async-storage": "1.17.11",
"@react-native-community/datetimepicker": "6.7.3",
"@react-native-community/netinfo": "9.3.7",
"@react-native-community/netinfo": "9.3.10",
"@react-native-community/slider": "4.4.2",
"@react-native-masked-view/masked-view": "0.2.8",
"@react-native-picker/picker": "2.4.8",
Expand All @@ -82,7 +82,7 @@
"react-dom": "18.2.0",
"react-native": "0.72.0-rc.5",
"react-native-gesture-handler": "~2.10.1",
"react-native-pager-view": "6.1.2",
"react-native-pager-view": "6.2.0",
"react-native-reanimated": "~3.1.0",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.20.0",
Expand Down
4 changes: 2 additions & 2 deletions apps/native-component-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@expo/react-native-action-sheet": "^3.8.0",
"@react-native-async-storage/async-storage": "1.17.11",
"@react-native-community/datetimepicker": "6.7.3",
"@react-native-community/netinfo": "9.3.7",
"@react-native-community/netinfo": "9.3.10",
"@react-native-community/slider": "4.4.2",
"@react-native-masked-view/masked-view": "0.2.8",
"@react-native-picker/picker": "2.4.8",
Expand Down Expand Up @@ -145,7 +145,7 @@
"react-native-dropdown-picker": "^5.3.0",
"react-native-gesture-handler": "~2.10.1",
"react-native-maps": "1.3.2",
"react-native-pager-view": "6.1.2",
"react-native-pager-view": "6.2.0",
"react-native-paper": "^4.0.1",
"react-native-reanimated": "~3.1.0",
"react-native-safe-area-context": "4.5.0",
Expand Down
2 changes: 1 addition & 1 deletion home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@gorhom/bottom-sheet": "4.4.6",
"@graphql-codegen/introspection": "^2.1.1",
"@react-native-async-storage/async-storage": "1.17.11",
"@react-native-community/netinfo": "9.3.7",
"@react-native-community/netinfo": "9.3.10",
"@react-navigation/bottom-tabs": "~6.4.0",
"@react-navigation/elements": "~1.3.6",
"@react-navigation/material-bottom-tabs": "~6.2.4",
Expand Down
10 changes: 5 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2077,9 +2077,9 @@ PODS:
- React-jsinspector (0.72.0-rc.5)
- React-logger (0.72.0-rc.5):
- glog
- react-native-netinfo (9.3.7):
- react-native-netinfo (9.3.10):
- React-Core
- react-native-pager-view (6.1.2):
- react-native-pager-view (6.2.0):
- React-Core
- react-native-safe-area-context (4.5.0):
- RCT-Folly
Expand Down Expand Up @@ -3716,7 +3716,7 @@ SPEC CHECKSUMS:
EXSplashScreen: 8d00c7b625ec0f952a17ab685e1f03ac0e5c1795
EXStructuredHeaders: f3a6d417d5d12ef369fd1a31320d1c188a1b0f4b
EXTaskManager: a7a387c4e222176988261341680aa7e3f621a335
EXUpdates: d01f25d40e711ac9b52f64c36410c1b30ac54e3b
EXUpdates: 61a44f682e0805d64953017f411918d7acbb1041
EXUpdatesInterface: c08eaa7e4d1fdafff3820e0539a6d42a75fa0258
FBAEMKit: c7efe06720a8b15b1d25b68921ba46dee20996e0
FBAudienceNetwork: e0fcc9091fced34910ed0b6da06f129db46ac9e6
Expand Down Expand Up @@ -3774,8 +3774,8 @@ SPEC CHECKSUMS:
React-jsiexecutor: 98c1b1c1e60e137703597e5c5025f2ce3e4700fe
React-jsinspector: 04038f19b6269374640d90371796f63d034d3542
React-logger: 4e8c28425ddc27abb6cde80eece89cc765da7d86
react-native-netinfo: 2517ad504b3d303e90d7a431b0fcaef76d207983
react-native-pager-view: 54bed894cecebe28cede54c01038d9d1e122de43
react-native-netinfo: ccbe1085dffd16592791d550189772e13bf479e2
react-native-pager-view: 0ccb8bf60e2ebd38b1f3669fa3650ecce81db2df
react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc
react-native-segmented-control: 06607462630512ff8eef652ec560e6235a30cc3e
react-native-skia: ff2265fb802b2a3e1bf4a3c5a86d46936dd20354
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-netinfo",
"version": "9.3.7",
"version": "9.3.10",
"summary": "React Native Network Info API for iOS & Android",
"license": "MIT",
"authors": "Matt Oakes <[email protected]>",
Expand All @@ -12,7 +12,7 @@
},
"source": {
"git": "https://github.com/react-native-community/react-native-netinfo.git",
"tag": "v9.3.7"
"tag": "v9.3.10"
},
"source_files": "ios/**/*.{h,m}",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

using namespace facebook::react;

@interface RNCPagerViewComponentView () <RCTRNCViewPagerViewProtocol, UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate>
@interface RNCPagerViewComponentView () <RCTRNCViewPagerViewProtocol, UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate, UIGestureRecognizerDelegate>

@property(nonatomic, assign) UIPanGestureRecognizer* panGestureRecognizer;

@end

@implementation RNCPagerViewComponentView {
Expand Down Expand Up @@ -63,6 +66,11 @@ - (instancetype)initWithFrame:(CGRect)frame
_destinationIndex = -1;
_layoutDirection = @"ltr";
_overdrag = NO;
UIPanGestureRecognizer* panGestureRecognizer = [UIPanGestureRecognizer new];
self.panGestureRecognizer = panGestureRecognizer;
panGestureRecognizer.delegate = self;
[self addGestureRecognizer: panGestureRecognizer];

}

return self;
Expand Down Expand Up @@ -260,6 +268,9 @@ - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {

const auto strongEventEmitter = *std::dynamic_pointer_cast<const RNCViewPagerEventEmitter>(_eventEmitter);
strongEventEmitter.onPageScrollStateChanged(RNCViewPagerEventEmitter::OnPageScrollStateChanged{.pageScrollState = RNCViewPagerEventEmitter::OnPageScrollStateChangedPageScrollState::Settling });

if (!_overdrag) {
NSInteger maxIndex = _nativeChildrenViewControllers.count - 1;
BOOL isFirstPage = [self isLtrLayout] ? _currentIndex == 0 : _currentIndex == maxIndex;
Expand All @@ -270,11 +281,12 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoi
if ((isFirstPage && contentOffset <= topBound) || (isLastPage && contentOffset >= topBound)) {
CGPoint croppedOffset = [self isHorizontal] ? CGPointMake(topBound, 0) : CGPointMake(0, topBound);
*targetContentOffset = croppedOffset;

strongEventEmitter.onPageScrollStateChanged(RNCViewPagerEventEmitter::OnPageScrollStateChanged{.pageScrollState = RNCViewPagerEventEmitter::OnPageScrollStateChangedPageScrollState::Idle });
}
}

const auto strongEventEmitter = *std::dynamic_pointer_cast<const RNCViewPagerEventEmitter>(_eventEmitter);
strongEventEmitter.onPageScrollStateChanged(RNCViewPagerEventEmitter::OnPageScrollStateChanged{.pageScrollState = RNCViewPagerEventEmitter::OnPageScrollStateChangedPageScrollState::Settling });

}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
Expand Down Expand Up @@ -394,6 +406,29 @@ + (ComponentDescriptorProvider)componentDescriptorProvider
}


- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {

// Recognize simultaneously only if the other gesture is RN Screen's pan gesture (one that is used to perform fullScreenGestureEnabled)
if (gestureRecognizer == self.panGestureRecognizer && [NSStringFromClass([otherGestureRecognizer class]) isEqual: @"RNSPanGestureRecognizer"]) {
UIPanGestureRecognizer* panGestureRecognizer = (UIPanGestureRecognizer*) gestureRecognizer;
CGPoint velocity = [panGestureRecognizer velocityInView:self];
BOOL isLTR = [self isLtrLayout];
BOOL isBackGesture = (isLTR && velocity.x > 0) || (!isLTR && velocity.x < 0);

if (self.currentIndex == 0 && isBackGesture) {
scrollView.panGestureRecognizer.enabled = false;
} else {
const auto &viewProps = *std::static_pointer_cast<const RNCViewPagerProps>(_props);
scrollView.panGestureRecognizer.enabled = viewProps.scrollEnabled;
}

return YES;
}
const auto &viewProps = *std::static_pointer_cast<const RNCViewPagerProps>(_props);
scrollView.panGestureRecognizer.enabled = viewProps.scrollEnabled;
return NO;
}

@end

Class<RCTComponentViewProtocol> RNCViewPagerCls(void)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#import "RCTOnPageSelected.h"
#import <math.h>

@interface ReactNativePageView () <UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate>
@interface ReactNativePageView () <UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate, UIGestureRecognizerDelegate>

@property(nonatomic, assign) UIPanGestureRecognizer* panGestureRecognizer;

@property(nonatomic, strong) UIPageViewController *reactPageViewController;
@property(nonatomic, strong) RCTEventDispatcher *eventDispatcher;
Expand Down Expand Up @@ -45,6 +47,10 @@ - (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher {
_cachedControllers = [NSHashTable hashTableWithOptions:NSHashTableStrongMemory];
_overdrag = NO;
_layoutDirection = @"ltr";
UIPanGestureRecognizer* panGestureRecognizer = [UIPanGestureRecognizer new];
self.panGestureRecognizer = panGestureRecognizer;
panGestureRecognizer.delegate = self;
[self addGestureRecognizer: panGestureRecognizer];
}
return self;
}
Expand Down Expand Up @@ -375,6 +381,8 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoi
if ((isFirstPage && contentOffset <= topBound) || (isLastPage && contentOffset >= topBound)) {
CGPoint croppedOffset = [self isHorizontal] ? CGPointMake(topBound, 0) : CGPointMake(0, topBound);
*targetContentOffset = croppedOffset;

[self.eventDispatcher sendEvent:[[RCTOnPageScrollStateChanged alloc] initWithReactTag:self.reactTag state:@"idle" coalescingKey:_coalescingKey++]];
}
}
}
Expand Down Expand Up @@ -458,6 +466,28 @@ - (NSString *)determineScrollDirection:(UIScrollView *)scrollView {
return scrollDirection;
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {

// Recognize simultaneously only if the other gesture is RN Screen's pan gesture (one that is used to perform fullScreenGestureEnabled)
if (gestureRecognizer == self.panGestureRecognizer && [NSStringFromClass([otherGestureRecognizer class]) isEqual: @"RNSPanGestureRecognizer"]) {
UIPanGestureRecognizer* panGestureRecognizer = (UIPanGestureRecognizer*) gestureRecognizer;
CGPoint velocity = [panGestureRecognizer velocityInView:self];
BOOL isLTR = [self isLtrLayout];
BOOL isBackGesture = (isLTR && velocity.x > 0) || (!isLTR && velocity.x < 0);

if (self.currentIndex == 0 && isBackGesture) {
self.scrollView.panGestureRecognizer.enabled = false;
} else {
self.scrollView.panGestureRecognizer.enabled = self.scrollEnabled;
}

return YES;
}

self.scrollView.panGestureRecognizer.enabled = self.scrollEnabled;
return NO;
}

- (BOOL)isLtrLayout {
return [_layoutDirection isEqualToString:@"ltr"];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-pager-view",
"version": "6.1.2",
"version": "6.2.0",
"summary": "React Native wrapper for Android and iOS ViewPager",
"homepage": "https://github.com/callstack/react-native-pager-view#readme",
"license": "MIT",
Expand All @@ -10,7 +10,7 @@
},
"source": {
"git": "https://github.com/callstack/react-native-pager-view.git",
"tag": "6.1.2"
"tag": "6.2.0"
},
"source_files": "ios/**/*.{h,m,mm}",
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/expo/bundledNativeModules.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"@react-native-async-storage/async-storage": "1.17.11",
"@react-native-community/datetimepicker": "6.7.3",
"@react-native-masked-view/masked-view": "0.2.8",
"@react-native-community/netinfo": "9.3.7",
"@react-native-community/netinfo": "9.3.10",
"@react-native-community/slider": "4.4.2",
"@react-native-community/viewpager": "5.0.11",
"@react-native-picker/picker": "2.4.8",
Expand Down Expand Up @@ -88,7 +88,7 @@
"react-native-gesture-handler": "~2.10.1",
"react-native-get-random-values": "~1.8.0",
"react-native-maps": "1.3.2",
"react-native-pager-view": "6.1.2",
"react-native-pager-view": "6.2.0",
"react-native-reanimated": "~3.1.0",
"react-native-screens": "~3.20.0",
"react-native-safe-area-context": "4.5.0",
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3303,10 +3303,10 @@
dependencies:
invariant "^2.2.4"

"@react-native-community/[email protected].7":
version "9.3.7"
resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-9.3.7.tgz#92407f679f00bae005c785a9284e61d63e292b34"
integrity sha512-+taWmE5WpBp0uS6kf+bouCx/sn89G9EpR4s2M/ReLvctVIFL2Qh8WnWfBxqK9qwgmFha/uqjSr2Gq03OOtiDcw==
"@react-native-community/[email protected].10":
version "9.3.10"
resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-9.3.10.tgz#9b6cc2aec9329b5ccf35e866094c43aa420d927a"
integrity sha512-OwnqoJUp/4sa9e3ju+wQavAa8l0fiA3DheeLMKzKxtKeAe0CA7bNxWRM752JvRQ6A/igPnt1V0zSlu5owvQEuA==

"@react-native-community/[email protected]":
version "4.4.2"
Expand Down Expand Up @@ -15897,10 +15897,10 @@ [email protected]:
dependencies:
"@types/geojson" "^7946.0.8"

react-native-pager-view@6.1.2:
version "6.1.2"
resolved "https://registry.yarnpkg.com/react-native-pager-view/-/react-native-pager-view-6.1.2.tgz#3522079b9a9d6634ca5e8d153bc0b4d660254552"
integrity sha512-qs2KSFc+7N7B+UZ6SG2sTvCkppagm5fVyRclv1KFKc7lDtrhXLzN59tXJw575LDP/dRJoXsNwqUAhZJdws6ABQ==
react-native-pager-view@6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/react-native-pager-view/-/react-native-pager-view-6.2.0.tgz#51380d93fbe47f6380dc71d613a787bf27a4ca37"
integrity sha512-pf9OnL/Tkr+5s4Gjmsn7xh91PtJLDa6qxYa/bmtUhd/+s4cQdWQ8DIFoOFghwZIHHHwVdWtoXkp6HtpjN+r20g==

react-native-paper@^4.0.1:
version "4.12.0"
Expand Down

0 comments on commit 4442897

Please sign in to comment.