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

Highlighted Icon not changing #2

Open
nirmaldalmia opened this issue May 10, 2020 · 1 comment
Open

Highlighted Icon not changing #2

nirmaldalmia opened this issue May 10, 2020 · 1 comment

Comments

@nirmaldalmia
Copy link

I used the floating action bar to build a navigation component. When I navigate using the icons on the action bar, it works fine. But when I change the index programmatically, the screen changes but the highlighted icon on the action bar doesn't change.

const ActionBar = (props) => {
	const selectedIndex = props.inputStore.selectedNavigationIndex;
	console.log('Navigation index on render: ', selectedIndex);
	return (
		<FloatingActionBar
			items={items}
			offset={25}
			onPress={(index: number) =>
				props.inputStore.setSelectedNavigationIndex(index)
			}
			position="bottom"
			selectedIndex={selectedIndex}
		/>
	);
};

selectedIndex is a property that is stored in the MobX store. It is initialized to 0. The navbar has 4 screens, the first screen has a button which can be used to move from first screen to the third screen. On press of the button, I update the selectedIndex in the store. The screen changes but the highlighted icon on the navbar is still the 0th index. The console statement tells me that the index was updated. Any help will be much appreciated!

@skd1993
Copy link

skd1993 commented Jul 19, 2020

I have the same problem, looks like the "icon" accepts a parameter called "active" which is not being updated unless clicked. But don't know how it can be accessed and changed dynamically.

Also, I am able to set "selectedIndex" greater than length of items object array, which reproduces the above mentioned behaviour.

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

No branches or pull requests

2 participants