Skip to content
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

feat: rewrite v4 native-stack to TS #793

Merged
merged 5 commits into from
Mar 2, 2021
Merged

Conversation

WoLewicki
Copy link
Member

@WoLewicki WoLewicki commented Jan 28, 2021

Description

PR migrating v4 native-stack to TS 🎉

Many options available in v4 native-stack are taken from stack-navigator, they are included in StackNavigatorOptions and NativeStackNavigationConfig types. There is also a type that is not used in v5 native-stack and gives an option to use HeaderBackButton from react-navigation-stack, it is called BackButtonProps.

Some of the props used for HeaderBackButton have been changed because the former props didn't match the actual props from HeaderBackButton. We keep the former props for backwards compatibility. Changed props are:

  • backButtonTitle: resolves to label instead of title,
  • truncatedBackButtonTitle: resolves to truncatedLabel instead of truncatedTitle,
  • backTitleVisible: resolves to labelVisible instead of backTitleVisible,
  • headerBackTitleStyle: resolves to labelStyle instead of titleStyle,
  • layoutPreset: resolves to titleLayout instead of layoutPreset,
  • scene was removed

Changes

Changed createNativeStackNavigator to TS.
Added proper types fields in package.jsons.
Changed Test765 to TS in TestsExample project.

Testing changes

Test765.jsx in TestsExample project.

Checklist

  • Included code example that can be used to test this change
  • Updated TS types
  • Ensured that CI passes

@WoLewicki WoLewicki mentioned this pull request Jan 28, 2021
3 tasks
@chirag04
Copy link
Contributor

i wonder if we should just drop support for v4. v5 has been out for quite some time and v6 is in the works.

@WoLewicki
Copy link
Member Author

I think we want to keep the v4. It doesn't require much work to keep it up-to-date since most of the code is on the native side, and there are still many people using react-navigation v4.

src/createNativeStackNavigator.tsx Outdated Show resolved Hide resolved
src/createNativeStackNavigator.tsx Outdated Show resolved Hide resolved
@WoLewicki WoLewicki merged commit dd5e370 into master Mar 2, 2021
@WoLewicki WoLewicki deleted the @wolewicki/v4-native-stack-ts branch March 2, 2021 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants