File tree Expand file tree Collapse file tree 9 files changed +39
-3
lines changed
android/src/main/java/com/rcttabview Expand file tree Collapse file tree 9 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,10 @@ Default options to use for the screens in the navigator.
109
109
110
110
Whether to show labels in tabs. Defaults to true.
111
111
112
+ #### ` disablePageAnimations `
113
+
114
+ Whether to disable page animations between tabs. (iOS only)
115
+
112
116
#### ` sidebarAdaptable `
113
117
114
118
A tab bar style that adapts to each platform. (Apple platforms only)
Original file line number Diff line number Diff line change @@ -137,4 +137,7 @@ class RCTTabViewViewManager :
137
137
138
138
@ReactProp(name = " ignoresTopSafeArea" )
139
139
fun setIgnoresTopSafeArea (view : ReactBottomNavigationView , flag : Boolean ) {}
140
+
141
+ @ReactProp(name = " disablePageAnimations" )
142
+ fun setDisablePageAnimations (view : ReactBottomNavigationView , flag : Boolean ) {}
140
143
}
Original file line number Diff line number Diff line change @@ -1209,7 +1209,7 @@ PODS:
1209
1209
- ReactCommon/turbomodule/bridging
1210
1210
- ReactCommon/turbomodule/core
1211
1211
- Yoga
1212
- - react-native-bottom-tabs (0.0.9 ):
1212
+ - react-native-bottom-tabs (0.0.10 ):
1213
1213
- DoubleConversion
1214
1214
- glog
1215
1215
- RCT-Folly (= 2024.01.01.00)
@@ -1793,7 +1793,7 @@ SPEC CHECKSUMS:
1793
1793
React-logger: 4072f39df335ca443932e0ccece41fbeb5ca8404
1794
1794
React-Mapbuffer: 714f2fae68edcabfc332b754e9fbaa8cfc68fdd4
1795
1795
React-microtasksnativemodule: 618b64238e43ef3154079f193aa6649e5320ae19
1796
- react-native-bottom-tabs: 6b4dff8469797a3bf8758594832955a2214e2e0d
1796
+ react-native-bottom-tabs: f2d0c291b0158846fb8c6964b9535a3ab206fdf2
1797
1797
react-native-safe-area-context: 851c62c48dce80ccaa5637b6aa5991a1bc36eca9
1798
1798
React-nativeconfig: 4a9543185905fe41014c06776bf126083795aed9
1799
1799
React-NativeModulesApple: 651670a799672bd54469f2981d91493dda361ddf
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ const FourTabsIgnoreSafeArea = () => {
27
27
return < FourTabs ignoresTopSafeArea /> ;
28
28
} ;
29
29
30
+ const FourTabsNoAnimations = ( ) => {
31
+ return < FourTabs disablePageAnimations /> ;
32
+ } ;
33
+
30
34
const examples = [
31
35
{ component : ThreeTabs , name : 'Three Tabs' } ,
32
36
{ component : FourTabs , name : 'Four Tabs' } ,
@@ -37,6 +41,7 @@ const examples = [
37
41
name : 'Four Tabs - No header' ,
38
42
screenOptions : { headerShown : false } ,
39
43
} ,
44
+ { component : FourTabsNoAnimations , name : 'Four Tabs - no animations' } ,
40
45
{ component : NativeBottomTabs , name : 'Native Bottom Tabs' } ,
41
46
{ component : JSBottomTabs , name : 'JS Bottom Tabs' } ,
42
47
{
Original file line number Diff line number Diff line change @@ -7,9 +7,13 @@ import { Chat } from '../Screens/Chat';
7
7
8
8
interface Props {
9
9
ignoresTopSafeArea ?: boolean ;
10
+ disablePageAnimations ?: boolean ;
10
11
}
11
12
12
- export default function FourTabs ( { ignoresTopSafeArea = false } : Props ) {
13
+ export default function FourTabs ( {
14
+ ignoresTopSafeArea = false ,
15
+ disablePageAnimations = false ,
16
+ } : Props ) {
13
17
const [ index , setIndex ] = useState ( 0 ) ;
14
18
const [ routes ] = useState ( [
15
19
{
@@ -48,6 +52,7 @@ export default function FourTabs({ ignoresTopSafeArea = false }: Props) {
48
52
< TabView
49
53
ignoresTopSafeArea = { ignoresTopSafeArea }
50
54
sidebarAdaptable
55
+ disablePageAnimations = { disablePageAnimations }
51
56
navigationState = { { index, routes } }
52
57
onIndexChange = { setIndex }
53
58
renderScene = { renderScene }
Original file line number Diff line number Diff line change @@ -30,5 +30,6 @@ - (UIView *)view
30
30
RCT_EXPORT_VIEW_PROPERTY (sidebarAdaptable, BOOL )
31
31
RCT_EXPORT_VIEW_PROPERTY(labeled, BOOL )
32
32
RCT_EXPORT_VIEW_PROPERTY(ignoresTopSafeArea, BOOL )
33
+ RCT_EXPORT_VIEW_PROPERTY(disablePageAnimations, BOOL )
33
34
34
35
@end
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ class TabViewProps: ObservableObject {
13
13
@Published var sidebarAdaptable : Bool ?
14
14
@Published var labeled : Bool ?
15
15
@Published var ignoresTopSafeArea : Bool ?
16
+ @Published var disablePageAnimations : Bool = false
16
17
}
17
18
18
19
/**
@@ -61,6 +62,12 @@ struct TabViewImpl: View {
61
62
}
62
63
. getSidebarAdaptable ( enabled: props. sidebarAdaptable ?? false )
63
64
. onChange ( of: props. selectedPage ?? " " ) { newValue in
65
+ if ( props. disablePageAnimations) {
66
+ UIView . setAnimationsEnabled ( false )
67
+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.1 ) {
68
+ UIView . setAnimationsEnabled ( true )
69
+ }
70
+ }
64
71
onSelect ( newValue)
65
72
}
66
73
. onAppear {
Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ struct TabData: Codable {
35
35
}
36
36
}
37
37
38
+ @objc var disablePageAnimations : Bool = false {
39
+ didSet {
40
+ props. disablePageAnimations = disablePageAnimations
41
+ }
42
+ }
43
+
38
44
@objc var labeled : Bool = true {
39
45
didSet {
40
46
props. labeled = labeled
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ interface Props<Route extends BaseRoute> {
31
31
* Whether to ignore the top safe area. (iOS only)
32
32
*/
33
33
ignoresTopSafeArea ?: boolean ;
34
+
35
+ /**
36
+ * Whether to disable page animations between tabs. (iOS only)
37
+ */
38
+ disablePageAnimations ?: boolean ;
34
39
/**
35
40
* State for the tab view.
36
41
*
You can’t perform that action at this time.
0 commit comments