Skip to content

Commit

Permalink
fix: display screen size
Browse files Browse the repository at this point in the history
  • Loading branch information
Marius456 committed Apr 22, 2024
1 parent 3c58430 commit b9dcc0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/template-starter/src/components/menu.tv.native.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useContext, useRef } from 'react';
import { Animated } from 'react-native';
import { Animated, useWindowDimensions } from 'react-native';
import { TouchableOpacity, Text, Screen, setFocus } from '@flexn/create';
import Icon from 'react-native-vector-icons/Ionicons';
import { ThemeContext, ROUTES, Ratio } from '../config';
Expand All @@ -11,6 +11,7 @@ const TRANSLATE_VAL_HIDDEN = Ratio(-300);

const Menu = ({ navigation }: { navigation?: any }) => {
const navigate = useNavigate({ navigation });
const { height } = useWindowDimensions();
const { theme } = useContext(ThemeContext);

const translateBgAnim = useRef(new Animated.Value(TRANSLATE_VAL_HIDDEN)).current;
Expand Down Expand Up @@ -59,7 +60,7 @@ const Menu = ({ navigation }: { navigation?: any }) => {

return (
<Screen
style={theme.styles.menuContainer}
style={[theme.styles.menuContainer, { minHeight: height }]}
onFocus={onFocus}
onBlur={onBlur}
focusOptions={{
Expand Down
8 changes: 7 additions & 1 deletion packages/template-starter/src/screens/screen.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Screen as FMScreen, ScreenProps, ScreenStates } from '@flexn/create';
import React, { useState, useCallback } from 'react';
import { useFocusEffect } from '../hooks';
import { useWindowDimensions } from 'react-native';

const Screen = ({ children, focusOptions, style, ...rest }: ScreenProps) => {
const [screenState, setScreenState] = useState<ScreenStates>('foreground');
const { height, width } = useWindowDimensions();

useFocusEffect(
useCallback(() => {
Expand All @@ -16,7 +18,11 @@ const Screen = ({ children, focusOptions, style, ...rest }: ScreenProps) => {
);

return (
<FMScreen focusOptions={{ ...focusOptions, screenState }} style={style} {...rest}>
<FMScreen
focusOptions={{ ...focusOptions, screenState }}
style={[style, { minHeight: height, minWidth: width }]}
{...rest}
>
{children}
</FMScreen>
);
Expand Down

0 comments on commit b9dcc0d

Please sign in to comment.