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

fix(Android): onLayout calls in bottom tabs with freezeOnBlur #2363

Closed
wants to merge 16 commits into from
Closed
2 changes: 1 addition & 1 deletion android/src/main/java/com/swmansion/rnscreens/Screen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Screen(
r: Int,
b: Int,
) {
if (container is ScreenStack && changed) {
if (changed) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added since the logic inside is intended only for native-stack. So I have no idea why removing it would change anything. Can we have more information?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WoLewicki I updated the description with some more information. That's all I got, I'll keep on investigating.

val width = r - l
val height = b - t

Expand Down
41 changes: 41 additions & 0 deletions apps/src/tests/Test2349.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {NavigationContainer} from '@react-navigation/native';
import React from 'react';
import {Text, View} from 'react-native';

function HomeScreen() {
return (
<View
style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}
onLayout={e => {
console.log('[HOME] screen onLayout layout:', e.nativeEvent.layout);
}}>
<Text>Home!</Text>
</View>
);
}

function SettingsScreen() {
return (
<View
style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}
onLayout={e => {
console.log('[SETTINGS] screen onLayout', e.nativeEvent.layout);
}}>
<Text>Settings!</Text>
</View>
);
}

const Tab = createBottomTabNavigator();

export default function App() {
return (
<NavigationContainer>
<Tab.Navigator screenOptions={{freezeOnBlur: true}}>
<Tab.Screen name="Home" component={HomeScreen} />
<Tab.Screen name="Settings" component={SettingsScreen} />
</Tab.Navigator>
</NavigationContainer>
);
}
alduzy marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions apps/src/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export { default as Test2252 } from './Test2252';
export { default as Test2271 } from './Test2271';
export { default as Test2282 } from './Test2282';
export { default as Test2232 } from './Test2332';
export { default as Test2349 } from './Test2349';
export { default as TestScreenAnimation } from './TestScreenAnimation';
export { default as TestHeader } from './TestHeader';
export { default as TestModalNavigation } from './TestModalNavigation';
Loading