-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement TabList animations for non-win32 platforms (#3124)
* Implement animations on mac * Fix animations not running initially on mac * Fix tests failing * Fix rebase errors * Change files * Fix tests failing again * Fix transforms being applied in wrong order * Fix indicator size not updating after initial tab layouts * Refactoring code + address nits * Fix build issue + bugs * Fix undefined error in animatedindicator hook * Update snapshot tests * Address nits
- Loading branch information
1 parent
eca610b
commit 73b5823
Showing
13 changed files
with
195 additions
and
70 deletions.
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
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-native-tablist-6f75159e-c201-4295-afa7-355d6104b969.json
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 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Add TabList page to mac tester", | ||
"packageName": "@fluentui-react-native/tablist", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-native-tester-3bd541bf-a464-40a8-95fd-191949e4f480.json
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 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Implement animations on mac", | ||
"packageName": "@fluentui-react-native/tester", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
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
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
15 changes: 14 additions & 1 deletion
15
packages/experimental/TabList/src/TabListAnimatedIndicator/TabListAnimatedIndicator.tsx
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 |
---|---|---|
@@ -1,10 +1,23 @@ | ||
/** @jsxRuntime classic */ | ||
import React from 'react'; | ||
import { Animated, View } from 'react-native'; | ||
|
||
import { stagedComponent } from '@fluentui-react-native/framework'; | ||
|
||
import type { AnimatedIndicatorProps } from './TabListAnimatedIndicator.types'; | ||
import { tablistAnimatedIndicatorName } from './TabListAnimatedIndicator.types'; | ||
import { useAnimatedIndicatorStyles } from './useAnimatedIndicatorStyles'; | ||
|
||
export const TabListAnimatedIndicator = stagedComponent(() => () => null); | ||
export const TabListAnimatedIndicator = stagedComponent<AnimatedIndicatorProps>((props) => { | ||
const styles = useAnimatedIndicatorStyles(props); | ||
return () => { | ||
return ( | ||
<View style={styles.container}> | ||
<Animated.View style={styles.indicator} /> | ||
</View> | ||
); | ||
}; | ||
}); | ||
TabListAnimatedIndicator.displayName = tablistAnimatedIndicatorName; | ||
|
||
export default TabListAnimatedIndicator; |
16 changes: 14 additions & 2 deletions
16
packages/experimental/TabList/src/TabListAnimatedIndicator/TabListAnimatedIndicator.types.ts
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 |
---|---|---|
@@ -1,8 +1,20 @@ | ||
import type { ViewStyle } from 'react-native'; | ||
import type { Animated, LayoutRectangle, ViewStyle } from 'react-native'; | ||
|
||
export const tablistAnimatedIndicatorName = 'TabListAnimatedIndicator'; | ||
export interface AnimatedIndicatorStyles { | ||
container: ViewStyle; | ||
indicator: ViewStyle; | ||
indicator: Animated.AnimatedProps<ViewStyle>; | ||
} | ||
export type AnimatedIndicatorStylesUpdate = Partial<AnimatedIndicatorStyles>; | ||
|
||
export interface TabLayoutInfo extends LayoutRectangle { | ||
startMargin?: number; | ||
tabBorderWidth?: number; | ||
} | ||
|
||
export interface AnimatedIndicatorProps { | ||
animatedIndicatorStyles?: AnimatedIndicatorStyles; | ||
selectedKey?: string; | ||
tabLayout?: { [key: string]: TabLayoutInfo }; | ||
vertical?: boolean; | ||
} |
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
Oops, something went wrong.