Compare commits

..

6 Commits

Author SHA1 Message Date
Krzysztof Magiera
c8845cbb6a Bump version -> 2.0.0-beta.10 2020-02-21 00:17:28 +01:00
Krzysztof Magiera
9bf2edd405 Revert updateContainer threading changes from #351. 2020-02-21 00:16:43 +01:00
Krzysztof Magiera
748cdc6fba Bump version -> 2.0.0-beta.9 2020-02-20 18:05:28 +01:00
Krzysztof Magiera
89cf0b7e52 Fix detaching VC from parent VC. (#351)
This change fixes the problem of container view controllers not being detached properly from its parent container VC. We fix this by detaching VC from didMoveToWindow. On top of that we also added a check to ensure the update of containers won't run unless JS batch is complete. This is to prevent partially updated headers.
2020-02-20 17:50:20 +01:00
Janic Duplessis
db4733ad05 Fix gestureEnabled for modal with no header on iOS (#325)
Since the config is only updated in the HeaderConfig view it will not get executed for stacks with no header. This fixes it by setting the prop directly in the Screen when the gestureEnabled prop is set.
2020-02-19 20:33:58 +01:00
Radek Czemerys
8952e698d2 docs: Replace useScreens with enableScreens for expo docs (#348)
fixes #346
2020-02-19 18:09:25 +01:00
6 changed files with 30 additions and 11 deletions

View File

@@ -67,9 +67,9 @@ yarn add react-native-screens
2. Open your App.js file and add the following snippet somewhere near the top of the file (e.g. right after import statements):
```js
import { useScreens } from 'react-native-screens';
import { enableScreens } from 'react-native-screens';
useScreens();
enableScreens();
```
3. That's all 🎉  enjoy faster navigation in your Expo app. Keep in mind screens are in pretty early phase so please report if you discover some issues.

View File

@@ -120,6 +120,17 @@
}
}
- (void)setGestureEnabled:(BOOL)gestureEnabled
{
#ifdef __IPHONE_13_0
if (@available(iOS 13.0, *)) {
_controller.modalInPresentation = !gestureEnabled;
}
#endif
_gestureEnabled = gestureEnabled;
}
- (UIView *)reactSuperview
{
return _reactSuperview;

View File

@@ -158,7 +158,6 @@
- (void)layoutSubviews
{
[super layoutSubviews];
[self reactAddControllerToClosestParent:_controller];
_controller.view.frame = self.bounds;
for (RNSScreenView *subview in _reactSubviews) {
subview.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
@@ -166,6 +165,16 @@
}
}
- (void)didMoveToWindow
{
if (self.window) {
[self reactAddControllerToClosestParent:_controller];
} else {
[_controller removeFromParentViewController];
[_controller didMoveToParentViewController:nil];
}
}
@end

View File

@@ -174,10 +174,14 @@
{
[super didMoveToWindow];
if (self.window) {
[self reactAddControllerToClosestParent:_controller];
// when stack is added to a window we try to update push and modal view controllers. It is
// because modal operations are blocked by UIKit when parent VC is not mounted, so we need
// to redo them when the stack is attached.
[self updateContainer];
} else {
[_controller removeFromParentViewController];
[_controller didMoveToParentViewController:nil];
}
}
@@ -299,7 +303,7 @@
// controller is still there
BOOL firstTimePush = ![lastTop isKindOfClass:[RNSScreen class]];
BOOL shouldAnimate = !firstTimePush && ((RNSScreenView *) lastTop.view).stackAnimation != RNSScreenStackAnimationNone && !_controller.presentedViewController;
BOOL shouldAnimate = !firstTimePush && ((RNSScreenView *) lastTop.view).stackAnimation != RNSScreenStackAnimationNone;
if (firstTimePush) {
// nothing pushed yet
@@ -358,7 +362,6 @@
- (void)layoutSubviews
{
[super layoutSubviews];
[self reactAddControllerToClosestParent:_controller];
_controller.view.frame = self.bounds;
}

View File

@@ -275,11 +275,7 @@
}
[navctr setNavigationBarHidden:shouldHide animated:YES];
#ifdef __IPHONE_13_0
if (@available(iOS 13.0, *)) {
vc.modalInPresentation = !config.screenView.gestureEnabled;
}
#endif
if (shouldHide) {
return;
}

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-screens",
"version": "2.0.0-beta.8",
"version": "2.0.0-beta.10",
"description": "First incomplete navigation solution for your react-native app.",
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",