-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Motivation** Make animation progress available inside a screen. **Test plan** Describe the **steps to test this change** so that a reviewer can verify it. Provide screenshots or videos if the change affects UI. The change must pass lint, typescript and tests.
- Loading branch information
1 parent
ecd0e66
commit 36d19bd
Showing
5 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as React from 'react'; | ||
|
||
import type { MaterialTopTabAnimationContext } from '../types'; | ||
|
||
export const TabAnimationContext = React.createContext< | ||
MaterialTopTabAnimationContext | undefined | ||
>(undefined); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as React from 'react'; | ||
|
||
import { TabAnimationContext } from './TabAnimationContext'; | ||
|
||
export function useTabAnimation() { | ||
const animation = React.useContext(TabAnimationContext); | ||
|
||
if (animation === undefined) { | ||
throw new Error( | ||
"Couldn't find values for tab animation. Are you inside a screen in Material Top Tab navigator?" | ||
); | ||
} | ||
|
||
return animation; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters