File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
android/src/main/java/com/swmansion/rnscreens Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -78,8 +78,30 @@ public Screen(ReactContext context) {
7878 setLayoutParams (new WindowManager .LayoutParams (WindowManager .LayoutParams .TYPE_APPLICATION ));
7979 }
8080
81+ private boolean iSChildrenFocus (View view ) {
82+ Object tag = view .getTag (R .id .view_tag_native_id );
83+ //workaround to allow child focusing in case of problems like on the player
84+ if (tag instanceof String && ((String ) tag ).contains ("descendentsfocus" )) {
85+ return true ;
86+ }
87+ if (view instanceof ViewGroup ) {
88+ ViewGroup viewGroup = (ViewGroup ) view ;
89+ for (int i = 0 ; i < viewGroup .getChildCount (); i ++) {
90+ View v = viewGroup .getChildAt (i );
91+ if (v != null && iSChildrenFocus (v )) {
92+ return true ;
93+ }
94+ }
95+ }
96+ return false ;
97+ }
98+
8199 @ Override
82100 protected boolean onRequestFocusInDescendants (final int dir , final Rect rect ) {
101+ boolean isChildFocus = iSChildrenFocus (this );
102+ if (isChildFocus ) {
103+ return super .onRequestFocusInDescendants (dir , rect );
104+ }
83105 return false ;
84106 }
85107
You can’t perform that action at this time.
0 commit comments