Skip to content

Commit

Permalink
Update StoryDecorator.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
michalziolkowski committed Nov 9, 2024
1 parent 87890b6 commit f58e257
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions testing/testing-components/src/decorators/StoryDecorator.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useEffect } from 'react';
import { SafeAreaView, StyleSheet, useColorScheme } from 'react-native';
import { StyleSheet, useColorScheme, View } from 'react-native';
import { setStatusBarStyle } from 'expo-status-bar';

import { useSafeAreaInsets } from 'react-native-safe-area-context';
const StoryDecorator =
({ placement }: { placement?: 'top' | 'center' | 'bottom' } = {}) =>
(Story: React.FC) => {
const theme = useColorScheme();
const insets = useSafeAreaInsets();

useEffect(() => {
setStatusBarStyle(theme === 'dark' ? 'light' : 'dark');
Expand All @@ -28,14 +29,19 @@ const StoryDecorator =
}

return (
<SafeAreaView
<View
style={[
containerStyle,
{ flex: 1, backgroundColor: theme === 'dark' ? '#333' : '#dfdfdf' },
{
flex: 1,
backgroundColor: theme === 'dark' ? '#333' : '#dfdfdf',
paddingBottom: insets.bottom,
paddingTop: insets.top,
},
]}
>
<Story />
</SafeAreaView>
</View>
);
};

Expand Down

0 comments on commit f58e257

Please sign in to comment.