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

Typescript/tab controller move to typescript #1079

Merged
merged 34 commits into from
Dec 22, 2020

Conversation

M-i-k-e-l
Copy link
Contributor

Description

TabController - move to typescript
This is step one from 3 (step 2 is move to functional component and 3 is to add a presenter for the centering).
There are a few TODOs for typescript, some will be removed once the move to functional component is done, but I'm not sure all will be removed, especially the ones that are related to reanimated, they don't export all of their types.

Changelog

TabController - move to typescript

src/index.ts Outdated
@@ -36,6 +36,7 @@ export {default as Overlay, OverlayTypes} from './components/overlay';
export {default as RadioButton, RadioButtonPropTypes, RadioButtonProps} from './components/radioButton/RadioButton';
export {default as RadioGroup, RadioGroupPropTypes, RadioGroupProps} from './components/radioButton/RadioGroup';
export {default as Switch, SwitchProps} from './components/switch';
export {default as TabController, TabControllerProps, TabBarItemProps} from './components/tabController';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TabBarItemProps might conflict in the future with our TabBar component which will probably have also TabBatItemProps :/
Maybe we can name this one TabControllerItemProps, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might get confusing since all the sub components there are (for TabController), and I'm not sure people won't need their props as well.
Maybe we can add them statically? Either on the component or create another "MegaProp" that has them all?
So either TabController.Props, TabController.TabBar.Props... or TabControllerProps.Main, TabControllerProps.TabBar...
Not sure how easy it is to do or understand, WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure you can create this type of nesting in typings...
If it's possible then let's do it..

I guess that's the reason other libraries' typings have weird long names..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with TabControllerProps namespace, let me know if that's ok

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The namespace is nice, but now users will need to do this?

TabControllerProps.TabControllerProps? it's a little weird don't you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:s

Any suggestions? TabControllerProps.Props or maybe create the namespace as TabController and everything will be inside it (but the it'll be TabController.TabController and worse TabController.TabController.TabBar).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, Im starting to think we should drop the namespace thing, it's a little messy and too nested.
Im not sure people are used to import typings this way.
I prefer to have
TabControllerProps
TabControllerBarProps
TabControllerItemProps
TabControllerPageProps, etc...

It's not the best, but feels simpler.. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, changed as you recommended

Copy link
Collaborator

@ethanshar ethanshar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall look good.
Wrote some comments.

Anyway, i Noticed some performance issues with the component, but I think it has nothing to do with your PR.
Recently, we update reanimated version to v13.1 and I noticed some weird issues in TabController.
Do you experience them as well?

src/components/tabController/PageCarousel.tsx Show resolved Hide resolved
src/components/tabController/TabBar.tsx Outdated Show resolved Hide resolved
src/components/tabController/TabBarItem.tsx Show resolved Hide resolved
src/components/tabController/TabPage.tsx Outdated Show resolved Hide resolved
src/components/tabController/index.tsx Outdated Show resolved Hide resolved
@M-i-k-e-l
Copy link
Contributor Author

M-i-k-e-l commented Dec 16, 2020

Overall look good.
Wrote some comments.

Anyway, i Noticed some performance issues with the component, but I think it has nothing to do with your PR.
Recently, we update reanimated version to v13.1 and I noticed some weird issues in TabController.
Do you experience them as well?

Yes, I think I know what you mean, it also sometimes does not go to the correct page. I was thinking that it might be solved with the new logic 🤞
Edit: looking at it again, not sure the new logic will fix it since it happens not only in centered mode.

@ethanshar
Copy link
Collaborator

Yes, I think I know what you mean, it also sometimes does not go to the correct page. I was thinking that it might be solved with the new logic 🤞
Edit: looking at it again, not sure the new logic will fix it since it happens not only in centered mode.

Ok.. so I just verified.
On react-native-reanimated@1.9.0 (the previous version we had), everything works great
After updating to react-native-reanimated@1.13.1 (which was required for something else) things started to go south..

So I suggest that after we merge this PR, We'll investigate the issue first before going forward.
Usually when there are issues because of version upgrade, it's probably something small we need to tweak. 🤞

@M-i-k-e-l
Copy link
Contributor Author

Yes, I think I know what you mean, it also sometimes does not go to the correct page. I was thinking that it might be solved with the new logic 🤞
Edit: looking at it again, not sure the new logic will fix it since it happens not only in centered mode.

Ok.. so I just verified.
On react-native-reanimated@1.9.0 (the previous version we had), everything works great
After updating to react-native-reanimated@1.13.1 (which was required for something else) things started to go south..

So I suggest that after we merge this PR, We'll investigate the issue first before going forward.
Usually when there are issues because of version upgrade, it's probably something small we need to tweak. 🤞

ok

ethanshar and others added 4 commits December 20, 2020 15:31
* Fix first tab item change doesn't repsond

* Memoize renderCodeBlock in TabController components
* master:
  configure 'max-len'; turn off 'jsx-no-bind' (#1087)
  remove unnecessary view (#1084)
  Counter Icon badge (#1081)
  checkbox variant - outline (#1067)
@ethanshar ethanshar merged commit 58340ed into master Dec 22, 2020
@M-i-k-e-l M-i-k-e-l deleted the typescript/tab-controller-move-to-typescript branch January 25, 2021 09:10
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.

None yet

2 participants