Skip to content

Commit d673e32

Browse files
authored
fix: layouting on Android move to zIndex (#125)
* fix: layouting on Android move to zIndex * fix: fabric
1 parent e96c92c commit d673e32

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"react-native-gesture-handler": "^2.20.0",
2626
"react-native-paper": "^5.12.5",
2727
"react-native-safe-area-context": "^4.11.0",
28-
"react-native-screens": "^3.34.0",
28+
"react-native-screens": "^3.35.0",
2929
"react-native-vector-icons": "^10.2.0"
3030
},
3131
"devDependencies": {

src/TabView.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,21 @@ const TabView = <Route extends BaseRoute>({
253253
);
254254
}
255255

256+
const focused = route.key === focusedKey;
257+
const zIndex = focused ? 0 : -1;
258+
256259
return (
257260
<View
258261
key={route.key}
259262
collapsable={false}
260-
style={[
261-
styles.fullWidth,
262-
Platform.OS === 'android' && {
263-
display: route.key === focusedKey ? 'flex' : 'none',
264-
},
265-
]}
263+
pointerEvents={focused ? 'auto' : 'none'}
264+
accessibilityElementsHidden={!focused}
265+
importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'}
266+
style={
267+
Platform.OS === 'android'
268+
? [StyleSheet.absoluteFill, { zIndex }]
269+
: styles.fullWidth
270+
}
266271
>
267272
{renderScene({
268273
route,

src/TabViewAdapter.android.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import NativeTabView from './TabViewNativeComponent';
22
import type { TabViewProps } from './TabViewNativeComponent';
33
import { StyleSheet, View } from 'react-native';
44

5-
const TabViewAdapter = ({ children, ...props }: TabViewProps) => {
5+
const TabViewAdapter = ({ children, style: _, ...props }: TabViewProps) => {
66
return (
77
<>
88
<View style={styles.content}>{children}</View>
9-
<NativeTabView {...props} style={styles.tabBar} />
9+
<NativeTabView {...props} />
1010
</>
1111
);
1212
};
@@ -24,7 +24,6 @@ const styles = StyleSheet.create({
2424
width: '100%',
2525
height: '100%',
2626
},
27-
tabBar: {},
2827
});
2928

3029
export default TabViewAdapter;

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13756,7 +13756,7 @@ __metadata:
1375613756
react-native-gesture-handler: ^2.20.0
1375713757
react-native-paper: ^5.12.5
1375813758
react-native-safe-area-context: ^4.11.0
13759-
react-native-screens: ^3.34.0
13759+
react-native-screens: ^3.35.0
1376013760
react-native-test-app: ^3.10.10
1376113761
react-native-vector-icons: ^10.2.0
1376213762
languageName: unknown
@@ -13874,16 +13874,16 @@ __metadata:
1387413874
languageName: node
1387513875
linkType: hard
1387613876

13877-
"react-native-screens@npm:^3.34.0":
13878-
version: 3.34.0
13879-
resolution: "react-native-screens@npm:3.34.0"
13877+
"react-native-screens@npm:^3.35.0":
13878+
version: 3.35.0
13879+
resolution: "react-native-screens@npm:3.35.0"
1388013880
dependencies:
1388113881
react-freeze: ^1.0.0
1388213882
warn-once: ^0.1.0
1388313883
peerDependencies:
1388413884
react: "*"
1388513885
react-native: "*"
13886-
checksum: 28c1f6e556c318ffcbd79d153b9612cc8a0b8d8b70f909d3cde2fd6d0586a7c151a449e57400d8996f4ee6c3b5140c5c4f643a427e974f6dc573b2bcd8eb7356
13886+
checksum: cb8a0c8d8a41a8a1065cc2253e4272a970366a7d80bc54e889b2f48de7ccccd3e828e2701de39c0453a67956ec0cad140fb506324cce04419b5e2eb495c038c2
1388713887
languageName: node
1388813888
linkType: hard
1388913889

0 commit comments

Comments
 (0)