@@ -68,13 +68,15 @@ public Screen getScreen() {
6868
6969 public void onContainerUpdate () {
7070 ScreenStackHeaderConfig config = findHeaderConfig ();
71- if (config != null && config .getScreenFragment ().getActivity () != null ) {
71+ boolean configInChild = checkIfChildWithConfig (getScreen ());
72+ if (!configInChild && config != null && config .getScreenFragment ().getActivity () != null ) {
73+ // if there is no child with config, we look for a parent with config to set the orientation
7274 config .getScreenFragment ().getActivity ().setRequestedOrientation (config .getScreenOrientation ());
7375 }
7476 }
7577
7678 private ScreenStackHeaderConfig findHeaderConfig () {
77- ViewParent parent = getScreen ();
79+ ViewParent parent = getScreen (). getContainer () ;
7880 while (parent != null ) {
7981 if (parent instanceof Screen ) {
8082 for (int i = 0 ; i < ((Screen ) parent ).getChildCount (); i ++) {
@@ -89,6 +91,22 @@ private ScreenStackHeaderConfig findHeaderConfig() {
8991 return null ;
9092 }
9193
94+ protected static boolean checkIfChildWithConfig (View view ) {
95+ if (view instanceof ViewGroup ) {
96+ for (int i = 0 ; i < ((ViewGroup ) view ).getChildCount (); i ++) {
97+ View child = ((ViewGroup ) view ).getChildAt (i );
98+ if (child instanceof ScreenStackHeaderConfig ) {
99+ return true ;
100+ } else {
101+ if (checkIfChildWithConfig (child )) {
102+ return true ;
103+ }
104+ }
105+ }
106+ }
107+ return false ;
108+ }
109+
92110 protected void dispatchOnWillAppear () {
93111 ((ReactContext ) mScreenView .getContext ())
94112 .getNativeModule (UIManagerModule .class )
0 commit comments