-
Notifications
You must be signed in to change notification settings - Fork 692
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
Typescript/tab controller move to typescript #1079
Conversation
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'; |
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.
TabBarItemProps
might conflict in the future with our TabBar component which will probably have also TabBatItemProps :/
Maybe we can name this one TabControllerItemProps, WDYT?
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.
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?
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.
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..
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.
I went with TabControllerProps
namespace, let me know if that's ok
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.
The namespace is nice, but now users will need to do this?
TabControllerProps.TabControllerProps
? it's a little weird don't you think?
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.
: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
).
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.
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?
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.
I agree, changed as you recommended
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.
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 🤞 |
Ok.. so I just verified. So I suggest that after we merge this PR, We'll investigate the issue first before going forward. |
ok |
* Fix first tab item change doesn't repsond * Memoize renderCodeBlock in TabController components
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