-
Notifications
You must be signed in to change notification settings - Fork 693
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
fixed onLayout measurements on web #3019
Conversation
@@ -216,6 +217,7 @@ const TabBar = (props: Props) => { | |||
activeBackgroundColor={activeBackgroundColor} | |||
{...item} | |||
{...context} | |||
style={[{flex}, item?.style]} |
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.
Can you memoize this style, it might affect performance if you are passing inline array style
@@ -201,8 +201,16 @@ const TabBar = (props: Props) => { | |||
} | |||
}); | |||
|
|||
const tabBarItemStyle = useMemo(() => |
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.
Is it working?
You are memoizing a function that returns a value and not the value
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 had an issue, changed it to useCallback
and passed the tabBarItemStyle
as dependency to the tabBarItems
.
Checked on mobile and web.
@ethanshar as we spoke, passing |
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.
Wrote a small comment, anyway approved
@@ -8,11 +8,13 @@ import {Colors, Typography, Spacings} from '../../style'; | |||
import Badge, {BadgeProps} from '../badge'; | |||
import View from '../view'; | |||
import TabBarContext from './TabBarContext'; | |||
import Constants from '../../commons/Constants'; | |||
import {TabControllerBarProps} from './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.
change to import type {TabControllerBarProps} from './TabBar';
It might have a cyclic require because TabBar imports TabBarItem and TabBarItem imports TabBar
Maybe just importing with type
is ok
Description
TabBarController
fix item size on web.TabBarItem
flex issue, settingflex to 1
on web only ifspreadItems
is set to true.Handeling the style of the
TabBarItem
fromTabBar
, thestyle
passed via propsoverride
it.Changelog
TabBarController
fix item size on web.Additional info
ticket 4115