@@ -114,14 +114,20 @@ const ANIMATED_ONE = new Animated.Value(1);
114114const getFloatingHeaderHeights = (
115115 routes : NavigationRoute [ ] ,
116116 insets : EdgeInsets | null ,
117+ descriptors : SceneDescriptorMap ,
117118 layout : Layout ,
118119 previous : { [ key : string ] : number }
119120) => {
120121 const defaultHeaderHeight = getDefaultHeaderHeight ( layout , insets ) ;
121122
122123 return routes . reduce (
123124 ( acc , curr ) => {
124- acc [ curr . key ] = previous [ curr . key ] || defaultHeaderHeight ;
125+ const { options = { } } = descriptors [ curr . key ] || { } ;
126+ const { height = previous [ curr . key ] } = StyleSheet . flatten (
127+ options . headerStyle || { }
128+ ) ;
129+
130+ acc [ curr . key ] = typeof height === 'number' ? height : defaultHeaderHeight ;
125131
126132 return acc ;
127133 } ,
@@ -202,6 +208,7 @@ export default class Stack extends React.Component<Props, State> {
202208 floatingHeaderHeights : getFloatingHeaderHeights (
203209 props . routes ,
204210 props . insets ,
211+ state . descriptors ,
205212 state . layout ,
206213 state . floatingHeaderHeights
207214 ) ,
@@ -234,15 +241,16 @@ export default class Stack extends React.Component<Props, State> {
234241
235242 const layout = { width, height } ;
236243
237- this . setState ( {
244+ this . setState ( state => ( {
238245 layout,
239246 floatingHeaderHeights : getFloatingHeaderHeights (
240247 this . props . routes ,
241248 this . props . insets ,
249+ state . descriptors ,
242250 layout ,
243251 { }
244252 ) ,
245- } ) ;
253+ } ) ) ;
246254 } ;
247255
248256 private handleFloatingHeaderLayout = ( {
0 commit comments