Skip to content

Commit 6d344d3

Browse files
committed
Fix AutoFocusGuide on non-tvos platforms
1 parent dbbf92c commit 6d344d3

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/ui/components/focus/AutoFocusGuide.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ export interface AutoFocusGuideProps {
1212
const FOCUS_GUIDE_STYLE: ViewStyle = {
1313
width: '100%',
1414
justifyContent: 'center',
15-
alignItems: 'center'
15+
alignItems: 'center',
1616
};
1717

1818
const TVFocusGuideView = lazy((): Promise<{ default: React.ComponentType<any> }> => {
19-
if (Platform.OS === 'ios' && Platform.isTV) {
20-
if (ReactNative.TVFocusGuideView) {
21-
return Promise.resolve({ default: ReactNative.TVFocusGuideView });
22-
} else {
23-
console.warn('TVFocusGuideView not supported, a dependency on react-native-tvos is required.');
24-
}
19+
if (ReactNative.TVFocusGuideView) {
20+
return Promise.resolve({ default: ReactNative.TVFocusGuideView });
21+
} else {
22+
console.warn('TVFocusGuideView not supported, a dependency on react-native-tvos is required.');
2523
}
2624
return Promise.resolve({ default: ({ children }) => <>{children}</> });
2725
});
@@ -31,9 +29,12 @@ const TVFocusGuideView = lazy((): Promise<{ default: React.ComponentType<any> }>
3129
*/
3230
export const AutoFocusGuide = (props: React.PropsWithChildren<AutoFocusGuideProps>) => {
3331
const { style, children } = props;
34-
return (
35-
<TVFocusGuideView autoFocus style={[FOCUS_GUIDE_STYLE, style]}>
36-
{children}
37-
</TVFocusGuideView>
38-
);
32+
if (Platform.OS === 'ios' && Platform.isTV) {
33+
return (
34+
<TVFocusGuideView autoFocus style={[FOCUS_GUIDE_STYLE, style]}>
35+
{children}
36+
</TVFocusGuideView>
37+
);
38+
}
39+
return <>{children}</>;
3940
};

0 commit comments

Comments
 (0)