New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow changing mode in navigationOptions for dynamic modal #2308
Conversation
Turns out I was wrong, setting isModal in CardStackTransitioner doesn't do the trick either, so I have no idea where the back animation comes from if not there, I can't find any reference to it. |
@JulianKingman Back animation seems to be a separate issue. Even without your changes it's behaviour is odd in "Modal Stack Example" - "Go to profile screen" is animated vertically, but back-animation is horizontal. In your modified example back navigation starts to work as expected if you click "Go to a photos screen" one more deeper and then click "Go back". |
Nope, I was wrong. In "Modal Stack Example" there is a nested navigator that causing unintuitive behaviour. But the good news is I made it to work correctly during back navigation! Check this out: |
Brilliant, thanks @davojan! I added the fix to my PR. |
@ericvicenti FYI, ready for review |
@JulianKingman I guess you should fix linter errors reported by the circleci before they'll consider reviewing :) |
Fixed. |
Working well for me, would be nice to see it merged. Thanks for sharing @JulianKingman! |
Looks like there are some conflicts, can you fix them? I'll try to check the PR asap |
@@ -15,7 +15,7 @@ | |||
"flow-bin": "^0.49.1", | |||
"react": "16.0.0-alpha.12", | |||
"react-native": "^0.45.1", | |||
"react-navigation": "*" | |||
"react-navigation": "designmanio/react-navigation" |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Any updates on this? It seems the conflicts are minimal (documentation and dependencies), so I guess it shouldn't be too hard to update and approve it? |
@JulianKingman good job. |
.expo/settings.json
Outdated
"minify": false, | ||
"urlType": "exp", | ||
"urlRandomness": null | ||
} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## master #2308 +/- ##
==========================================
+ Coverage 72.75% 72.83% +0.07%
==========================================
Files 53 53
Lines 1659 1671 +12
Branches 435 439 +4
==========================================
+ Hits 1207 1217 +10
- Misses 357 359 +2
Partials 95 95
Continue to review full report at Codecov.
|
@@ -14,32 +14,44 @@ const MyNavScreen = ({ navigation, banner }) => ( | |||
top: navigation.state.routeName === 'HeaderTest' ? 'always' : 'never', | |||
}} | |||
> | |||
<SampleText>{banner}</SampleText> | |||
<SampleText>{banner}</SampleText> |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
<Button onPress={() => navigation.goBack(null)} title="Go back" /> | ||
<StatusBar barStyle="default" /> | ||
</SafeAreaView> | ||
); | ||
} | ||
} | ||
|
||
const Modal = ({navigation}) => ( | ||
<MyNavScreen | ||
banner={`Modal in Screen Navigator`} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -14,7 +14,7 @@ | |||
"expo": "^25.0.0", | |||
"react": "16.2.0", | |||
"react-native": "^0.52.0", | |||
"react-navigation": "link:../.." | |||
"react-navigation": "file:../.." |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@spencercarli @stereodenis @Andreyco @kelset the branch is now updated. |
I think @ericvicenti should be the one reviewing this because we are undergoing some massive changes so I'm not sure this will be needed |
is that documented somewhere, this makes me worried. |
You can check the commits on master. We are not yet ready release a new version / post the release notes because we are still changing stuff, but yeah PR section & commits in master are the best way to be up-to-date if you don't want to wait for next release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One concern is that horizontal (non-modal) mode is super tricky, because you need to animate the previous screen at the same time as the active scene. So I think we do want to support this use case, but I'm not sure that hacking on CardStack is the best way to do it.
if (navigation.state.routes && navigation.state.routes[1]) { | ||
screenOptions = router.getScreenOptions( | ||
addNavigationHelpers({ | ||
state: navigation.state.routes[1], |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
And yes, as @kelset mentioned, we do have some big changes happening in this area. It should make features like this easier to add, moving forward! See the suggested changes here: #3392 @raarts , we are ramping up support, it shouldn't concern you! Feel free to follow along with progress on the issues and PRs in this repo, and by keeping an eye on the RFCs repo: https://github.com/react-navigation/rfcs |
This property very useful for customising TabBar look, but available only on Android. This commit add support for it for iOS.
Support iconStyle Tab Bar property on iOS
My bad for the intrusion, but is this still in consideration to merge in or similar future solution? I need this bad. |
I agree with @ericvicenti's assessment here, I'm not sure that this is the way we want to go for supporting modals. It may be, but I'd like to discuss further and have a proper RFC for this as it's a really key piece of the ergonomics of a navigation library (that we have up until now not provided a well-defined and supported path for, aside from creating a modal stack navigator). Please see this RFC placeholder issue: react-navigation/rfcs#15 -- if you want to take a stab at designing a solution to this, let's discuss there and we can take it into a formal RFC. Thank you @JulianKingman for this PR and creating good discussion around this, and sorry to everyone who has to continue to use a fork to support this feature! |
I need dynamic modals in my project and couldn't wait for #1378. It looked simple enough to implement, so I went ahead with it :)
I've got navigation animations working, but I'm having a heck of a time configuring the "back" animation.
Any idea where I can configure the navigator in such a way that I can influence the animation, and have per-screen navigationOptions available? As far as I can tell,
isModal
is currently defined inCardStackTransitioner
here: https://github.com/react-community/react-navigation/blob/master/src/views/CardStack/CardStackTransitioner.js#L77, which seems to apply isModal to the navigator universally.