Commit Graph

27 Commits

Author SHA1 Message Date
Jesse Katsumata
71a02af309 Add missing types (#262)
This issue closes #261 

Added typescript definitions for `<ScreenStack>` and `<ScreenStackHeaderConfig>`
2020-01-07 11:33:03 +01:00
Krzysztof Magiera
0919404b2e Add support for customizing back button image. (#253)
For customizing back button image we use platform native functionality that is: `setBackIndicatorImage` on iOS and `setHomeAsUpIndicator` on Android.
The reason we don't do that just by setting left item is that we get a couple of things for free such as handling RTL properly, working accessibility features, handling prop for hiding back button and a couple more.

Unfortunately there are some downsides to that approach too. We need to install the back button as an Image component from the JS side, and the extract the image payload on the native side to set it with the navigator. This is specifically problematic in DEV mode where images are loaded asynchronously over HTTP from the packager. In order for that to work we had to employ a few hacks (more comments on that in the code).
2019-12-20 21:59:34 +01: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
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
Janic Duplessis
c7f5fe6554 Fix RN version check when using master (#182) 2019-10-21 09:01:43 +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
Krzysztof Magiera
f8a104a698 Fix iOS back gesture handling (header config & touches) 2019-09-09 10:31:15 +02:00
Krzysztof Magiera
80a466970e Navigation stack native primitives (#139)
Adds support for stack navigation primitives (UINavigationViewController and Android fragment container with back button support)
2019-09-05 13:55:14 +02:00
Satyajit Sahoo
c1cbf77097 Add lazy requiring screens components (#117)
* Add lazy requiring screens components

* Fix naming

* Lazily initialize AnimatedNativeScreen
2019-07-04 12:44:32 +02:00
Michał Osadnik
b042571315 Add lazy requiring screens components (#115)
* Add lazy requiring screens components

* Fix naming
2019-07-04 12:41:00 +02:00
Satyajit Sahoo
acf80e640c Fix type of active prop in typescript definitions (#97)
The TS definitions specify the prop as a boolean, but passing a boolean causes a crash.
2019-05-13 14:40:47 +02:00
chrisnojima
0d082ad985 Fix the missing setRef handler (#91) 2019-04-30 07:54:26 +02:00
Evan Bacon
dd0d564cd3 [web] Default active prop to true (#90)
* navigation expects the default of `active` value to be `true`
* fixed typo
2019-04-25 10:53:14 +02:00
Evan Bacon
033a6d3167 [web] Added active prop (#88)
# Why

[`react-navigation-stack`](https://github.com/react-navigation/react-navigation-stack/pull/105) relies on Screens to be removed when the active prop is falsey.

# How

Set `display: none` when the `active` prop is `false` or an `Animated.Value` with a value of `0`.

Related: https://github.com/react-navigation/react-navigation-stack/pull/105
2019-04-19 12:18:08 +02:00
Krzysztof Magiera
68a02d58d7 Android alpha compositing (#50)
This change adds an ability for screen container on Android to apply the correct mechanism for transparent layer blending. This is specifically important as screens are usually a complex views that may displays many layers and while transitioning often opacity is used to animate these. When we detect screen transitioning we (a) turn on offscreen alpha compositing (which makes the opacity being applied for the whole screen layer at once instead of making all the children semi-transparent) and also (b) turn on hardware layer that makes offscreen compositing render to GPU (which is both faster and consumes only GPU memory).

In addition to that change we also need to disable wrapping Screen's children with View, as in such a case opacity is applied on the underlying View instead of a Screen. That workaround has been added because of a bug in Animated library and fixed in RN 0.57+
2018-12-20 09:06:28 +01:00
Krzysztof Magiera
35120d9f8a Export native screen components so that they can be wrapped in reanimated view wrapper 2018-10-12 13:52:22 +02:00
Janic Duplessis
7ffdccd377 Use getViewManagerConfig when available to remove warning (#28) 2018-10-08 09:06:53 +02:00
Krzysztof Magiera
1a1b38f7d4 Rename screens.shared and screens.js to .native.js and .web.js to support react native web users properly 2018-10-02 20:35:42 +02:00
Bruno Lemos
4cf7b82a11 Fix for unsupported platforms (#22)
Fixes #13 for real
Fixes https://github.com/react-navigation/react-navigation/issues/5004

Use different `index.js` files for supported and unsupported platforms.

Tested on iOS and on an existing web project that uses react-navigation.

---

!['react-native' does not contain an export named 'requireNativeComponent'.](https://user-images.githubusercontent.com/619186/46323012-8164e300-c5c2-11e8-964e-b6f233776dab.png)

Necolas explained here that this import should not be on any file that runs on web: https://github.com/necolas/react-native-web/issues/507#issuecomment-307953785
2018-10-02 15:59:23 +02:00
Louis Lagrange
118068ed13 Minimal support for other platforms
Such as web, windows...
2018-09-24 22:06:40 +02:00
Cameron Knight
7a1668abca Add typescript definitions 2018-09-19 16:04:22 -07:00
Krzysztof Magiera
14e1334505 Export screensEnabled method to test if screens support is switched ON 2018-09-17 12:09:50 +02:00
Brent Vatne
73759537e3 Fix typo in error message and be specific about the README 2018-09-12 16:44:37 +02:00
Krzysztof Magiera
3feb754553 Filter out onComponentRef to avoid passing it to the fallback View component 2018-09-11 14:43:39 +02:00
Krzysztof Magiera
60511a7e90 Make it possible to enable/disable screens support with useScreen function 2018-09-11 11:29:47 +02:00
Krzysztof Magiera
d940a02fac Add compatibility layer for screens so that they can be used when native lib is not installed. 2018-09-07 13:45:20 +02:00
Krzysztof Magiera
31281d6b68 Initial commit. 2018-08-03 13:54:11 +02:00