Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions apps/src/tests/Test2811.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { NavigationContainer } from '@react-navigation/native';
import { NativeStackNavigationProp, createNativeStackNavigator } from '@react-navigation/native-stack';
import React from 'react';
import { Text, View } from 'react-native';

type StackRouteParamList = {
Home: undefined;
};

type StackRouteNavProps = {
navigation: NativeStackNavigationProp<StackRouteParamList>;
};

const Stack = createNativeStackNavigator<StackRouteParamList>();

function Home({ navigation }: StackRouteNavProps) {

React.useEffect(() => {
const timerHandle = setTimeout(() => {
navigation.setOptions({
headerRight: () => <HeaderSubview size={20} />,
});
}, 1500);

return () => {
clearTimeout(timerHandle);
};
}, [navigation]);

//React.useEffect(() => {
// navigation.setOptions({
// headerRight: () => <HeaderSubview size={20} />,
// });
//}, [navigation]);

return (
<View style={{ flex: 1, backgroundColor: 'seagreen' }}>
<Text>Home</Text>
</View>
);
}

function HeaderSubview({ size }: { size?: number }) {
const finalSize = size ?? 20;
return (
<View style={{ backgroundColor: 'crimson', width: finalSize, height: finalSize, maxHeight: finalSize }} />
);
}

export default function App() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={Home} options={{
//headerRight: () => <HeaderSubview size={20} />,
}} />
</Stack.Navigator>
</NavigationContainer>
);
}
2 changes: 2 additions & 0 deletions apps/src/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export { default as Test2675 } from './Test2675';
export { default as Test2717 } from './Test2717';
export { default as Test2767 } from './Test2767';
export { default as Test2789 } from './Test2789';
export { default as Test2811 } from './Test2811';
export { default as TestScreenAnimation } from './TestScreenAnimation';
export { default as TestScreenAnimationV5 } from './TestScreenAnimationV5';
export { default as TestHeader } from './TestHeader';
Expand All @@ -137,3 +138,4 @@ export { default as TestFormSheet } from './TestFormSheet';
export { default as TestAndroidTransitions } from './TestAndroidTransitions';
export { default as TestAnimation } from './TestAnimation';


Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,21 @@ class RNSScreenStackHeaderConfigComponentDescriptor final
shadowNode.getState());
auto stateData = state->getData();

if (stateData.frameSize.width != 0 && stateData.frameSize.height != 0) {
layoutableShadowNode.setSize(stateData.frameSize);
#ifdef ANDROID
if (stateData.frameSize.width != 0) {
layoutableShadowNode.setSize({stateData.frameSize.width, YGUndefined});
layoutableShadowNode.setPadding({
stateData.paddingStart,
0,
stateData.paddingEnd,
0,
});
#endif // ANDROID
}
#else
if (stateData.frameSize.width != 0 && stateData.frameSize.height != 0) {
layoutableShadowNode.setSize(stateData.frameSize);
}
#endif // ANDROID

ConcreteComponentDescriptor::adopt(shadowNode);
#if !defined(ANDROID) && !defined(NDEBUG)
Expand Down
Loading