-
Notifications
You must be signed in to change notification settings - Fork 81
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
Programatically control active tab for tabbar #970
Comments
Can you share how you try to do this? I think I know what's going wrong and if so a fix is on the way. |
Oh man I just came here to ask that exact question as well. I'll show you what I did, it's an awful solution in my opinion but the docs here are pretty scarce in detail.
I hope someone else can chime in and indicate the proper way to do things, I've spent a few hours looking at the examples and source with no answer. |
In addition to that, for me I get this when trying to use the TabBar (since Tabs is marked as deprecated):
|
Here's a dummy example, because my code too complex to paste here. I hope I didn't mess it up . Also, I'm using 1.5.1-beta1 because that's the only one that compiles with little mods with my typescript setup
|
Yes I think it's a thing that is linked to #931 |
@replaysMike I think your version is too old for |
@r1cs1 your example seems fine, as long as that |
@cromefire indeed you seem to be right, I'm running 1.5.0 (default installed for |
Yes the docs are already representing the beta version and there is currently no good way to see the older docs |
@r1cs1 Please try |
I'm not sure, if |
@cromefire now active seems to be working when it's set outside of TabBar. I mean if I set the state NOT via onclick event on the Tab elements. Basically what I want to achieve is to cancel tab switching based on some conditions. However it seems internal click handlers are more powerful :) |
@cromefire On the other hand, I always get the following error since 1.5.1-xxx
Replacing it by this code seems to solve it, but not sure if it causes any other issues or if it's correct liek that:
|
Yes that's something that needs to be changed, doing that tomorrow (CEST). |
@r1cs1 I would try
|
Yeah tabBar isn't really a prop friendly underneath. |
Also same for Tabs |
Example: https://1040718yoq.codesandbox.io P.s. swipe left right for active tabs |
Signed-off-by: Cromefire_ <tim.l@nghorst.net>
@prateekbh Thanks, man! |
So as it seems to work like this I'll close it. |
* Release (#793) * Doc changes (#742) * fixing version number * fixing env target * changing docs language * new deps (#741) * new deps * Sync with Prettier * Sync with Prettier * fixing docs pics * fixing pics (#743) * fixing pics * Update package.json * fixing pics * Update docs (#785) * fixing version number * fixing env target * changing docs language * new deps (#741) * new deps * Sync with Prettier * Sync with Prettier * fixing docs pics * fixing pics (#743) * fixing pics * Update package.json * fixing pics * upgrading to 34 (#744) * upgrading to 34 * Sync with Prettier * text field value support * Sync with Prettier * Sync with Prettier * fixing tests * Release docs (#790) * fixing version number * fixing env target * changing docs language * new deps (#741) * new deps * Sync with Prettier * Sync with Prettier * fixing docs pics * fixing pics (#743) * fixing pics * Update package.json * fixing pics * upgrading to 34 (#744) * upgrading to 34 * Sync with Prettier * text field value support * Sync with Prettier * Sync with Prettier * fixing tests * close greenkeeper (#786) * updating to mdc 35 (#787) * updating to mdc 35 * Sync with Prettier * fixing errors and adding typography * test fix * fixing new images * Sync with Prettier * adding routes in pre-render * bug fix * test fixes * Prettierfix (#797) - optional prettier fix - hoek fix * v1.4.5 - Fixed typings for Typography. (#798) * Fix Tabs within TabBarScroller initialized multiple times (#796) * 🔥 Remove `indicator-accent` from `Tabs` component Remove `indicator-accent` from `Tabs` as it is no longer used (material-components/material-components-web#1965) * Add TabBarScrollerTabs component - `TabBarScrollerTabs` should be used within `TabBarScroller` instead of `Tabs`. - Component name is inspired by class name used by @material/mdc-tab: '.mdc-tab-bar-scroller__scroll-frame__tabs' - `scroller` property is no longer needed on `Tabs` and allows a simpler implementation - `activeTabIndex` can be used on `Tabs` and `TabBarScroller` to select active tab index * Fix prettier formatting * Uptable tabs golden screenshot * typo in import (#799) * chore(package): update webpack-cli to version 3.0.0 (#800) * Update @material/rtl to the latest version 🚀 (#801) * fix(package): update @material/rtl to version 0.36.0 * Sync with Prettier * Don't bundle a copy of Preact into dist (#826) * Update index.js * Updating deps (#827) * Doc changes (#742) * fixing version number * fixing env target * changing docs language * new deps (#741) * new deps * Sync with Prettier * Sync with Prettier * fixing docs pics * fixing pics (#743) * fixing pics * Update package.json * fixing pics * Update docs (#785) * fixing version number * fixing env target * changing docs language * new deps (#741) * new deps * Sync with Prettier * Sync with Prettier * fixing docs pics * fixing pics (#743) * fixing pics * Update package.json * fixing pics * upgrading to 34 (#744) * upgrading to 34 * Sync with Prettier * text field value support * Sync with Prettier * Sync with Prettier * fixing tests * updating mdcweb * Update package.json * Update to v36 (#828) * Doc changes (#742) * fixing version number * fixing env target * changing docs language * new deps (#741) * new deps * Sync with Prettier * Sync with Prettier * fixing docs pics * fixing pics (#743) * fixing pics * Update package.json * fixing pics * Update docs (#785) * fixing version number * fixing env target * changing docs language * new deps (#741) * new deps * Sync with Prettier * Sync with Prettier * fixing docs pics * fixing pics (#743) * fixing pics * Update package.json * fixing pics * upgrading to 34 (#744) * upgrading to 34 * Sync with Prettier * text field value support * Sync with Prettier * Sync with Prettier * fixing tests * adding IconButton * Sync with Prettier * adding icon button * fixing screen shots * adding docs * Sync with Prettier * fixing docs * chore(package): update eslint to version 5.0.0 (#833) * Default id for TextFieldInput (#830) * Default id for TextFieldInput If showDiv is false, id is not available for TextFieldInput when id not defined in props. Generate id for both. * Update TextField.jsx * TextField improvements (#853) * Fixed missing dependency for prettier (+eslint rules) Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added outlined to TextField Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added outerStyle to TextField Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed prettier formatting Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Switched from classProperties syntax Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added Outlined documentation and fixed documentation link for TextField Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added outlined sample Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added changed images for documentation tests Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Bumped version to 1.4.7 Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * updating deps (#855) * outlined select (#857) * outlined select * fixing ts defination * fixing tests * bump package.json * Fixed visible line ripple when outlined and outerStyle in case of no helper text is shown (#856) * Fixed visible line ripple when outlined Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed outerStyle in case no helper text is used Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added outerStyle documentation Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added outerStyle documentation Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed missing prop Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed label name in sample Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Updated test image to new text field documentation Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed outline="true" showing in <input> element Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added helperTextOuterStyle to make styling of the wrapper around helper text and input possible Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Switched to intermediateStyle with defaults Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Made intermediateStyle optional Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added updated textfield verification image Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Removed intermediateStyle Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added image for changed documentation Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Removed unneeded default props Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Applied changes defined in review Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Also bumped version to 1.5.0 Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Updated textfield doc test image Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * fixes double body (#875) * fixes double body * Sync with Prettier * re-add diffs * re-add diffs * fixing pics * revert threashold * change wait to timeout * timeout as networkidle0 * fixing screen shots * Card: change prop 16-9 to sixteenByNine (#868) * Card: change prop 16-9 to sixteenByNine * add className if sixteenByNine prop is present * updating deps (#879) * Update index.d.ts (#861) * fixing double render * fixing golden docs * Fixed imports in TopAppBar demo (#916) * Fixed imports in TopAppBar demo * updated the reference image * Improve build system (#878) * Added yarn.lock to .gitignore to open a PR changes are required * Added basic typescript infrastructure and moved switch to typescript * Sync with Prettier * Readded webpack build * Set target to es2015 and removed webpack again * Migrated MaterialComponent and set up tslint * Let typescript transpile jsx syntax * Added updated .ignores * Added typescript parser for prettier * Reverted parser change * Excluding future build artifacts * Added babel for transpiling * Added babel options * Fixed travis doc test to fail, if no failed images are generated * Improved failing if compile failed * Updated babel version * Fixed compile fail detection * Migrated Typography * Migrated TopAppBar * Migrated Toolbar * Sync with Prettier * Migrated TextField * Migrated Tabs and added linting to test * Migrated Snackbar and Slider * Migrated Select * Migrated Radio * Migrated Menu and List * Sync with Prettier * Migrated LineRipple * Migrated LinearProgress and LayoutGrid * Migrated ImageList * Migrated IconButton, IconToggle and Icon and added types for mwc * Migrated GridList, FormField, Fab and Elevation * Sync with Prettier * Migrated Drawer, Dialog, Chips, Checkbox, Card and Button * Fixed wrong references * Fixed lint issues and readded webpack to build * Fixed type issue with html elements * Added autogeneration of /Component/index.d.ts and started using autobind for Component classes * Excluded declarations from git and prettier * Removed accidental autobind-decorator from docs * Implemented autobind * Fixed tslint style * Added tslint fixer * Fixed test script * Sync with Prettier * Remove still tracked js file Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed missing props and children Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Set typescript to strict mode Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed Select Page Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Sync with Prettier * Fixed sample Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed sample Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Cleared TODOs Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed componentWillUnmount() for IconButton Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Integrated primary and secondary into MaterialComponent Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Sync with Prettier * Revert "Integrated primary and secondary into MaterialComponent" This reverts commit a5498b9 Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Migrated primary and secondary back to Button and Fab Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed props in materialDom() Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed LinearProgress themeProp declaration Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added disables to IconButtons mdcProps Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed /index in import Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed /index in import in .js files Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed IconButton props Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed type for onChange Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed props and added TODOs for mismatching ones Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * removing sample * fixing a few props * bumping version * dont compile sample * fixing select * fixing tests * Fixed types.d.ts not in generated output and switched from this.base to this.control in Select and Switch Fixes #918 Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Fixed TextFieldProps becase TextField is not a MDComponent Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Letting babel only run once Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Added babel runtime Signed-off-by: Cromefire_ <cromefirehd@gmail.com> * Updated .ignore Files Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Excluded .babelrc, .prettierignore and .eslintignore from npm package Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Update to38 (#919) * updating deps * added deprecation notice * Fix code typo on homepage (#917) The wrong package is being imported. * Make the two card demos look different (#870) * Added valid to TextFieldProps (#920) * Added valid to TextFieldProps Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Sync with Prettier * Changes for38 (#923) * fixing list and switch * implementing tab-bar * bug fix * Sync with Prettier * re-order * Fixed style * resolving comments * adding css file * Sync with Prettier * fixing golden tests * fixing golden test * Adjusting docs for 1.5.1 (#924) * Added changelog for 1.5.1 Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Sync with Prettier * Updated README for 1.5.1 Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Added new build system to doc page and implemented Fire Code for code Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Fixed Tab bar page code Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Fixed TabBar page typo Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Set font display to swap Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Removed component list from README * Updated test images Signed-off-by: Cromefire_ <tim.l@nghorst.net> * chore(package): update eslint-config-prettier to version 3.0.0 (#925) * Delegated MDComponent notification to MaterialComponent Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Added value to TextField notify props Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Fixed value notify prop on TextField Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Added fixed value prop to TextField Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Removed unneeded setValid Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Added disabled notification to Checkbox Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Added babel runtime as runtime dependecy (#922) * Added babel runtime as runtime dependecy * Sync with Prettier * Also update classText on update Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Reverted to reversed Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Only conditionally rebuilding className Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Published 1.5.1-experimental2 from the right branch and removed docs and .idea from npm package Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Removed debug log Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Removed MDComponent hasOwnProperty check Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Fixed disabled prop accidentally removed from element Signed-off-by: Cromefire_ <tim.l@nghorst.net> * experimental4 Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Fixed className generation on update Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Fixed className generation for TextField Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Sync with Prettier * renamed reverse prop in docs back to reversed Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Fixed some last minor issues Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Making requested changes Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Removed value notification Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Added active notification for Tab Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Released experimental 7 Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Improved TypeScript typing for soft merge (See #970) Signed-off-by: Cromefire_ <tim.l@nghorst.net> * Updated version to 1.5.1 Signed-off-by: Cromefire_ <tim.l@nghorst.net>
what is this repository? |
nuka carousel |
@prateekbh I'd like see the code TabBar full component |
https://codesandbox.io/s/1040718yoq |
@cromefire thanks so much! |
Hi guys,
I'm trying to programatically control active tab for tabbar, however neither activeTabIndex on TabBar, nor active prop on Tab is working.
Am I missing something or that's expected?
Thanks,
Richard
The text was updated successfully, but these errors were encountered: