Skip to content

Commit

Permalink
⚡️ Replaces Dimensions.get with useWindowDimensions().width to get Wi…
Browse files Browse the repository at this point in the history
…dth dynamically (#26)
  • Loading branch information
ojag95 authored Dec 26, 2023
1 parent 45520a8 commit 23eb05a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/Layout/Container/Container.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Dimensions, StyleSheet, View, ViewProps } from 'react-native';
import { StyleSheet, View, ViewProps,useWindowDimensions } from 'react-native';

import { getConfig } from '../../../utils/grid';
import { getGridBreakpoint } from '../../../utils/responsive';
Expand Down Expand Up @@ -39,7 +39,8 @@ const Container = ({
/** container maxWidth */
const maxWidth = gridConfig.containerMaxWidths[gridBreakpoint];
/** screen width */
const SCREEN_WIDTH = Dimensions.get('window').width;

const SCREEN_WIDTH = useWindowDimensions().width;

return (
<Element
Expand Down

0 comments on commit 23eb05a

Please sign in to comment.