Commit Graph

195 Commits

Author SHA1 Message Date
Krzysztof Magiera
2b55d60780 Bump version -> 2.0.0-alpha.16 2.0.0-alpha.16 2019-12-02 16:01:49 +01:00
Krzysztof Magiera
744b37fbc3 Fix Android's toolbar config update (#244)
Before this change, updates made to toolbar's subviwews weren't properly reflected. We'd only add new views to toolbar w/o removing stale ones.
2019-12-02 10:47:17 +01:00
Krzysztof Magiera
84d684b52d Support RNN wrapper's animationEnabled option (#243) 2019-12-02 10:45:40 +01:00
Krzysztof Magiera
6f9c504627 Bump version -> 2.0.0-alpha.15 2.0.0-alpha.15 2019-11-29 13:16:50 +01:00
Krzysztof Magiera
953763f7d9 Support containedModal mode in RNN stack (#241) 2019-11-29 13:12:39 +01:00
Krzysztof Magiera
7c351df14d Reset header navbar items when not set. (#240)
This fixes the problem when navbar settings update from ones that have header items (e.g. custom title object) to a config without such items. In such a case we'd set navbar items in the first go and never reset those items.
2019-11-29 13:11:08 +01:00
Krzysztof Magiera
da9426b4b9 Bump version -> 2.0.0-alpha.14 2.0.0-alpha.14 2.0.0-alp 2019-11-29 11:20:15 +01:00
Krzysztof Magiera
4169fad8b3 Support headerBackTitleVisible and cadrStyle options. (#239) 2019-11-29 11:19:23 +01:00
Krzysztof Magiera
4f8efd2873 Revert "Fix navbar window fitting on Android. (#235)"
This reverts commit 0927e03687.
2019-11-27 22:17:52 +01:00
Krzysztof Magiera
cbc86bb6d8 Avoid changing back stack when fragment manager is not resumed. (#237)
This change fixes the problem when there are changes being made to the stack while the hosting activity is in paused state (e.g. an activity-based dialog from google play services). In such a case it is not allowed to do any changes which can affect fragment manager's state (e.g. updating backstack). For other changes we use `commitAllowingStatLoss` to indicate we are not interested in fragment manager handling their restoration and hence we can perform most operations. Unfortunately installing back handler is not allowed without state change and we need to wait until the fragment host is resumed before we install it.
2019-11-27 22:00:16 +01:00
Krzysztof Magiera
0927e03687 Fix navbar window fitting on Android. (#235)
This change fixes the issue of handling transparent status bar. In such a case the navbar should became slightly bigger in order to fill the status bar space that now belongs to the window. In order for that to happen we use `setFitsSystemWindows` on main screen layout, on app bar layout and on toolbar (the toolbar is the view that gets bigger in the end).

Note that this currently only work if we use Android's native mechanism for changingthe status bar behavior and not using `StatusBar` module from RN. It is because `StausBar` module actually strips top insets from the event that gets delivered to the views. For the time being you can try the following to change status bar:
```
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
```

Note that we are also disabling app bar's scroll behavior. We wasn't utilising this yet, and it cause some weird errors on hot reload because scrolling behavior actually sets `firsSystemWindows` flag on the screen view which ended up consuming insets before appbar would get them.
2019-11-27 12:35:26 +01:00
Janic Duplessis
efaf0cd125 Fix titleFontSize on Android (#227) 2019-11-26 19:08:34 +01:00
Krzysztof Magiera
21e6a9732a Bump version -> 2.0.0-alpha.13 2019-11-26 15:33:58 +01:00
Krzysztof Magiera
31192250e1 Fix stack nesting on Android. (#234)
This change fixes two issues related to stack nesting on Android.

First one being the fact that root and nested fragments were relying on the same fragment manager as opposed to using nested fragment manager structure (via getChildFragmentManager). This resulted in an unprodictable behavior when displaying the top screen. This commit changes this behavior by correctly returning child fragment manager or root fragment manager depending on the containers hierarchy.

Second issue was related to back stack handling and resulted in always the root fragment manager interacting. Instead we want the bottommost active stack to handle back presses. This has been addressed by adding `setPrimaryNavigationFragment` when creating back stack entries.
2019-11-26 15:32:41 +01:00
Krzysztof Magiera
124e8acb2d Bump version -> 2.0.0-alpha.12 2.0.0-alpha.12 2019-11-22 13:03:35 +01:00
Krzysztof Magiera
2c5f95cea6 Fix updating stack config props. (#231)
When some of config props change or new header items are added we need to perform a header update. This diff adds logic to trigger updating header props when that happens.
2019-11-22 13:03:11 +01:00
Janic Duplessis
0a2336d005 [native-stack] Add flip transition on iOS (#225) 2019-11-20 11:12:50 +01:00
Krzysztof Magiera
58d1791d4a Bump version -> 2.0.0-alpha.11 2.0.0-alpha.11 2019-11-14 09:16:31 +01:00
Krzysztof Magiera
3d56c5d4e2 Bump version -> 2.0.0-alpha.10 2019-11-14 09:16:05 +01:00
Krzysztof Magiera
47658d4d7d Fix issue with stack triggering back on reload on Android. (#223)
There was an issue with back stack listener being triggered after reload caused by the fact we weren't cleaning up stack manager's back stack on reload. As a result after reload listener would get triggered with and empty stack first and only then with a back stack with 1 item. Consequence of the first trigger was that we'd call dismiss and move back from the top screen which wasn't a desirable behavior.
2019-11-13 22:45:08 +01:00
Krzysztof Magiera
258ae419de Bump version -> 2.0.0-alpha.9 2019-11-13 19:47:57 +01:00
Krzysztof Magiera
62123f16f9 Fix screen layout with non-translucent header on iOS. (#222)
After #184 we no longer were acconting for the size of navigation bar when laying out screens on the stack. This was causing elements to be drawn under a non-translucent bar unless SafeAreaView's been used. As this seem not to be desirable in most of the cases (there is no way of seeing items rendered underneath non-translucent header) this change brings back the previous behavior. Instead of using manual method of calculating top inset as it's been done before we rely on edgesForExtendedLayout property of the view controller.
2019-11-13 19:47:37 +01:00
Krzysztof Magiera
a94424192b Fix iOS stack navigator restoring state. (#221)
When more than one screen is initially mounted we were only installing the top navigator with UINavController. This was cauing the back-handling logic to not work properly.
2019-11-13 18:30:30 +01:00
Krzysztof Magiera
752d6c0f04 Bump version -> 2.0.0-alpha.8 2.0.0-alpha.8 2019-11-06 22:04:14 +01:00
Krzysztof Magiera
a017713efc Fix screen container layout on Android. (#217)
This is a similar fix to the one already merged in #215 but for Android this time. We change default screen container to layout its direct children without using flexbox. This is to follow the same pattern as with native stack container.
2019-11-06 21:57:31 +01:00
Krzysztof Magiera
26384b625e Use fragment manager back stack to handle hw back button presses on Android. (#216)
Before this change we'd rely on new androidx OnBackPressedCallback mechanism. It turns out not to work well in a few cases. The biggest problem with it was that when registered it'd never allow for the hw back button press to fallback to a system default behaviour and instead would always "still" that event. After several attempts of trying to make it work I decided to revert back to a FragmentManager's default solution.

This change adds an ability to use FragmentManager's back stack API. There are also a few problems with it we need to workaround though. One of the problem is the fact that we can not modify back stack history. What we do because of that is that we try to keep at most one item on the back stack and reset it each time our native stack updates. In order for that to work we create a fake transaction that hides and shows the same screen that displays on top. Thanks to that when hw back is pressed the built in transaction rollback logic does nothing to the UI and allows us to handle back navigation using back stack change listener.
2019-11-06 21:54:19 +01:00
Krzysztof Magiera
5d5e8bfca6 Fix screen container after rnsscreen layout change. (#215)
For native stack we introduced a new way of layouting screen controllers. We no longer rely on flexbox to layout them so that we can use native stack to provide a correct dimensions and safe area paddings. Unfortunately this change broke the old screen container. With this commit we are adapting layout change to old screen container that will now layout its direct children on the native side by making them take up the whole space of the container.
2019-11-06 21:54:05 +01:00
Sunny Luo
2536837795 Fix compile error on xcode 10 (#212) 2019-11-05 14:05:23 +01:00
osdnk
20650a8ede Bump -> 2.0.0-alpha.7 2.0.0-alpha.7 2019-10-31 12:22:48 +01:00
Michał Osadnik
ee0dbfe8ae Revert "Fix deprecated items (#156)" (#209)
This reverts commit 5a9b3d1408.
2019-10-31 12:15:40 +01:00
Krzysztof Magiera
23cbc009d4 Bump version -> 2.0.0-alpha6 2019-10-25 14:19:24 +02:00
Krzysztof Magiera
f21a093918 Make it possible for iOS largeTitle to collapse while scrolling. (#202)
iOS navbar largeTitle setting allows the navbar to be automatically collapsed when scrolling. For that to work iOS expects scrollable component to be rendered in the screen view hierarchy as a first children (or just to be looked up on the ancestor path using first children when navigating down). On top of that in RN we should use contentInsetAdjustmentBehavior="automatic" for SV's contentInsets to adjust as expected when the header scrolls and to allow for the SV background to be present below the navigation bar.

This works pretty well w/o any changes. However when testing I disovered one issue with the navigation bar rendering in a collapsed state on the first render. After that you could've scroll down to reveal large title bar but the initial state would be collapsed. As on iOS it is expected for large title enabled screens to initially render in the revealed state a workaround was required. It turned out that the header rendered in collapsed state because at the moment when navigation controller is created is has an empty list of view controllers. The list is empty because react first creates nnavigation controller and only then adds children to it. It turned out the fix was to populate viewControllers with a single item at first, then when controllers list is replaced with the children provided from react the header renders properly in the revealed state.
2019-10-25 14:17:59 +02:00
Krzysztof Magiera
1d4712acbd iOS13 header customization updates. (#201)
This change makes it possible for header customization options to use appearence API introduces in iOS 13. Thanks to this the default header setting will respect header translucency. Thanks to the appearence API we no longer need to set so many properties in setAnimatedConfig.
2019-10-25 14:06:55 +02:00
Janic Duplessis
09c71a45a2 Remove es exports from screens.native.js (#193)
Follow up of 4749405d64, let's remove the es exports from this file to avoid confusion. It uses `module.export`.
2019-10-23 23:01:50 +02:00
Janic Duplessis
79e664f11d Fix iOS version runtime checks in RNSScreenStackHeaderConfig (#195)
- `@available` should not be used with other conditions (not sure if it breaks anything but it does trigger warnings in xcode)
- missing runtime check before using `modalInPresentation`, kept the precompiler instruction so it still builds on older xcodes.
2019-10-23 23:01:29 +02:00
Ferran Negre
b622abc935 fix: typo pops = props (#197) 2019-10-23 23:00:23 +02:00
Krzysztof Magiera
7d4bbb8f88 Some compatibility adjustments for react-navigation bindings (#196) 2019-10-23 16:04:50 +02:00
Krzysztof Magiera
7c304a007f Expose 'hideShadow' option in react naviation bindings (#192) 2019-10-22 23:57:39 +02:00
Krzysztof Magiera
adf3333462 Avoid calling deprecated cancel method on a root view (#191) 2019-10-22 23:41:35 +02:00
Krzysztof Magiera
d4636d3130 Android native stack bugfixes. (#190)
A few bugs fixed with android native stack in this commit:
 - fixed a problem with views not resizing when keyboard appears, the bug was due to onMeasure forwardin getHeight which was the old height of the container instead of the changed one
 - fixed a problem with back button behavior not being consistent. Now back button is controlled by 'gestureEnabled' to emulate iOS behavior where there is no hw back button but you can swipe back instead.
 - added compatibility for "contained" modal styles - for now we always render "containted" fragments on Android, plan to add a way to render in dialogs in the future
2019-10-22 23:22:48 +02:00
Krzysztof Magiera
4749405d64 Fix useScreens -> enableScreens renaming (#189)
There was a bug in PR that introduces enableScreens method to replace useScreens. The bug was that the method did not end up being exported (we use module.exports and not export syntax). On top of that I'm adding a deprecation warning to useScreens method as it interferes with some react hooks tooling.
2019-10-22 23:17:24 +02:00
osdnk
faff1138f7 Bump to 2.0.0-alpha.5 2.0.0-alpha.6 2.0.0-alpha.5 2019-10-21 11:38:02 +02:00
Janic Duplessis
b9473ccb04 Support fade in animation for modals on iOS (#186)
Supporting fade in for modals can be done by using `modalTransitionStyle = UIModalTransitionStyleCrossDissolve`. For other type of animations we leave this as the default value.

Tested via `@react-navigation/native-stack` with `{ animation: 'fade', presentation: 'transparentModal' }`
2019-10-21 11:35:52 +02:00
David
5cfe3f2814 Apply custom title font attributes to largeTitle (#183) 2019-10-21 09:03:43 +02:00
Janic Duplessis
c7f5fe6554 Fix RN version check when using master (#182) 2019-10-21 09:01:43 +02:00
Janic Duplessis
535902014d Fix non-default modal presentation styles (#185)
* Fix non-default modal presentation styles

Using alternative modal presentation styles like `transparentModal` is not working. This is because accessing `presentationController` before setting the `modalPresentationStyle` causes the presentation controller to be created and cannot be changed afterwards. This is documented https://developer.apple.com/documentation/uikit/uiviewcontroller/1621426-presentationcontroller?language=objc.

Yes very cool API

Tested via @react-navigation/native-stack using presentation: 'transparentModal'.

* Update RNSScreen.m
2019-10-21 09:01:02 +02:00
Krzysztof Magiera
4a9a3a877a Fix header rendering – layout and transparency (#184)
* Let UINavController control subcontroller view's frames.

This PR changes the way we've been handling yoga <> NavController layout interactions. Now we ignore frame updates coming from react for the main Screen view to allow NavController take the controll. In order to keep yoga working we now use `setSize` to pass the dimensions of the view back to yoga such that it can properly calculate layout of the views under Screen component.

* Header resizing fixes for Android.

In this change we use CoordinatorLayout as a stack screen container to handle rendering of toolbar and screen content. Thanks to this approach we can support collapsable bars in the future. Instead of relying on RN to layout screen container when renered under ScreenStack we rely on Android native layout to measure and position screen content and then use UIManager.setNodeSize to communicate that back to react.
2019-10-18 15:08:39 +02:00
Lorenzo Sciandra
c590283359 Enhancement: change to useScreens to enableScreens (#99)
This wants to be a small PR to improve the usability of the library, based on this conversation: https://twitter.com/grifotv/status/1127847192067215360.

Since the release of RNS there has been a new major player in the React game: hooks. And sadly `useScreens` recalls too closely Hooks, and this can lead to misunderstanding.

Changing it to `enableScreens` will make the difference clear, but at the same time it will be a BREAKING CHANGE for everyone using the lib.

So if we prefer to keep it around as useScreens I'm ok with it too, and we can close this.

Also, I did some tweaks to the README + fix some typos.
2019-10-11 21:57:48 +02:00
osdnk
77b1e14288 Bump -> 2.0.0-alpha.4 2.0.0-alpha.4 2019-10-11 13:00:25 +02:00
Krzysztof Magiera
cb710c63f7 Fix iOS Example project after upgrade to RN 61 (#179) 2019-10-10 21:08:36 +02:00