Skip to content

Commit 1e1b586

Browse files
committed
fix(example-app): 🐛 remove bottom white space visible in iOS screens
1 parent ba5a834 commit 1e1b586

21 files changed

+77
-34
lines changed

example/src/App.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react";
2-
import { LogBox, SafeAreaView, StatusBar } from "react-native";
2+
import { LogBox, StatusBar } from "react-native";
33
import { GestureHandlerRootView } from "react-native-gesture-handler";
4+
import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
45
import { AdaptUIProvider } from "@adaptui/react-native-tailwind";
56
import { NavigationContainer } from "@react-navigation/native";
67
import tailwind from "twrnc";
@@ -17,15 +18,18 @@ const App = () => {
1718
style={tailwind.style(
1819
`flex-1 android:mt-[${StatusBar.currentHeight || 0}px]`,
1920
)}
21+
edges={["bottom"]}
2022
>
21-
<StatusBar
22-
translucent
23-
backgroundColor={"transparent"}
24-
barStyle="dark-content"
25-
/>
26-
<AdaptUIProvider>
27-
<AppRoot />
28-
</AdaptUIProvider>
23+
<SafeAreaProvider>
24+
<StatusBar
25+
translucent
26+
backgroundColor={"transparent"}
27+
barStyle="dark-content"
28+
/>
29+
<AdaptUIProvider>
30+
<AppRoot />
31+
</AdaptUIProvider>
32+
</SafeAreaProvider>
2933
</SafeAreaView>
3034
</NavigationContainer>
3135
</GestureHandlerRootView>

example/src/components/Group.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { PropsWithChildren } from "react";
2-
import { ViewProps } from "react-native";
2+
import { View, ViewProps } from "react-native";
33
import {
44
Box,
55
styleAdapter,
@@ -15,7 +15,7 @@ export const Group = (props: PropsWithChildren<GroupType>) => {
1515
const { children, label, style, ...other } = props;
1616
const tailwind = useTheme();
1717
return (
18-
<Box
18+
<View
1919
style={[
2020
tailwind.style("bg-white-800 rounded-xl p-2 flex-col w-full"),
2121
styleAdapter(style),
@@ -30,6 +30,6 @@ export const Group = (props: PropsWithChildren<GroupType>) => {
3030
>
3131
{children}
3232
</Box>
33-
</Box>
33+
</View>
3434
);
3535
};

example/src/modules/feedback/CircularProgressScreen.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { SetStateAction, useState } from "react";
2+
import { useSafeAreaInsets } from "react-native-safe-area-context";
23
import {
34
Box,
45
Button,
@@ -46,6 +47,7 @@ export const CircularProgressScreen = () => {
4647
const [selectedSize, setSelectedSize] = useState<CircularProgressSizes>("md");
4748
const [hasHints, setHasHints] = useState<boolean>(false);
4849
const [hasCustomTrack, setHasCustomTrack] = useState<boolean>(false);
50+
const safeAreaInsets = useSafeAreaInsets();
4951

5052
return (
5153
<Box style={tailwind.style("flex-1 justify-center bg-white-900")}>
@@ -67,7 +69,7 @@ export const CircularProgressScreen = () => {
6769
</Box>
6870
<Box
6971
style={tailwind.style(
70-
"rounded-t-lg shadow-lg bg-gray-100 justify-end p-2",
72+
`rounded-t-lg shadow-lg bg-gray-100 justify-end px-2 pt-2 pb-[${safeAreaInsets.bottom}]`,
7173
)}
7274
>
7375
<RadioGroup

example/src/modules/feedback/MeterComponentScreen.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { SetStateAction, useState } from "react";
2+
import { useSafeAreaInsets } from "react-native-safe-area-context";
23
import {
34
Box,
45
Meter,
@@ -21,6 +22,7 @@ export const MeterComponentScreen = () => {
2122
const [hasIntervals, setHasIntervals] = useState<boolean>(false);
2223
const [hasHints, setHasHints] = useState<boolean>(false);
2324
const [hasLabel, setHasLabel] = useState<boolean>(false);
25+
const safeAreaInsets = useSafeAreaInsets();
2426

2527
return (
2628
<Box style={tailwind.style("flex-1 justify-center bg-white-900")}>
@@ -41,7 +43,7 @@ export const MeterComponentScreen = () => {
4143
</Box>
4244
<Box
4345
style={tailwind.style(
44-
"rounded-t-lg shadow-lg bg-gray-100 justify-end p-2",
46+
`rounded-t-lg shadow-lg bg-gray-100 justify-end px-2 pt-2 pb-[${safeAreaInsets.bottom}]`,
4547
)}
4648
>
4749
<RadioGroup

example/src/modules/feedback/ProgressScreen.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { SetStateAction, useState } from "react";
2+
import { useSafeAreaInsets } from "react-native-safe-area-context";
23
import {
34
Box,
45
Button,
@@ -47,6 +48,7 @@ export const ProgressScreen = () => {
4748

4849
const [hasHints, setHasHints] = useState<boolean>(false);
4950
const [hasLabel, setHasLabel] = useState<boolean>(false);
51+
const safeAreaInsets = useSafeAreaInsets();
5052

5153
return (
5254
<Box style={tailwind.style("flex-1 justify-center bg-white-900")}>
@@ -72,7 +74,7 @@ export const ProgressScreen = () => {
7274
</Box>
7375
<Box
7476
style={tailwind.style(
75-
"rounded-t-lg shadow-lg bg-gray-100 justify-end p-2",
77+
`rounded-t-lg shadow-lg bg-gray-100 justify-end px-2 pt-2 pb-[${safeAreaInsets.bottom}]`,
7678
)}
7779
>
7880
<RadioGroup

example/src/modules/feedback/SpinnerScreen.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState } from "react";
2+
import { useSafeAreaInsets } from "react-native-safe-area-context";
23
import {
34
Box,
45
Radio,
@@ -19,6 +20,7 @@ export const SpinnerScreen = () => {
1920
const [selectedSize, setSelectedSize] = useState<SpinnerSizes>("md");
2021
const [selectedSpinnerTrackVisibility, setSelectedSpinnerTrackVisibility] =
2122
useState<SpinnerTrackVisibility>("transparent");
23+
const safeAreaInsets = useSafeAreaInsets();
2224

2325
return (
2426
<Box style={tailwind.style("flex-1 justify-center bg-white-900")}>
@@ -34,10 +36,9 @@ export const SpinnerScreen = () => {
3436
track={selectedSpinnerTrackVisibility}
3537
/>
3638
</Box>
37-
3839
<Box
3940
style={tailwind.style(
40-
"rounded-t-lg shadow-lg bg-gray-100 justify-end p-2",
41+
`rounded-t-lg shadow-lg bg-gray-100 justify-end px-2 pt-2 pb-[${safeAreaInsets.bottom}]`,
4142
)}
4243
>
4344
<RadioGroup

example/src/modules/forms/CheckboxGroupScreen.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { SetStateAction, useState } from "react";
2+
import { useSafeAreaInsets } from "react-native-safe-area-context";
23
import {
34
Box,
45
Checkbox,
@@ -22,6 +23,7 @@ export const CheckboxGroupScreen = () => {
2223
const [selectedSize, setSelectedSize] = useState<CheckboxSizes>("md");
2324
const [isDisabled, setIsDisabled] = useState<boolean>(false);
2425
const [isInvalid, setIsInvalid] = useState<boolean>(false);
26+
const safeAreaInsets = useSafeAreaInsets();
2527

2628
return (
2729
<Box style={tailwind.style("flex-1 justify-center bg-white-900")}>
@@ -50,7 +52,7 @@ export const CheckboxGroupScreen = () => {
5052
</Box>
5153
<Box
5254
style={tailwind.style(
53-
"rounded-t-lg shadow-lg bg-gray-100 justify-end p-2",
55+
`rounded-t-lg shadow-lg bg-gray-100 justify-end px-2 pt-2 pb-[${safeAreaInsets.bottom}]`,
5456
)}
5557
>
5658
<RadioGroup

example/src/modules/forms/InputScreen.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { SetStateAction, useCallback, useRef, useState } from "react";
2+
import { useSafeAreaInsets } from "react-native-safe-area-context";
23
import {
34
Box,
45
Button,
@@ -26,6 +27,7 @@ export const InputScreen = () => {
2627
const [hasPrefix, setHasPrefix] = useState<boolean>(false);
2728
const suffix = hasSuffix ? <Icon icon={<Slot />} /> : null;
2829
const prefix = hasPrefix ? <Icon icon={<Slot />} /> : null;
30+
const safeAreaInsets = useSafeAreaInsets();
2931

3032
const inputRef = useRef<any>(null);
3133

@@ -53,7 +55,7 @@ export const InputScreen = () => {
5355
</Box>
5456
<Box
5557
style={tailwind.style(
56-
"rounded-t-lg shadow-lg bg-gray-100 justify-end p-2",
58+
`rounded-t-lg shadow-lg bg-gray-100 justify-end px-2 pt-2 pb-[${safeAreaInsets.bottom}]`,
5759
)}
5860
>
5961
<RadioGroup

example/src/modules/forms/RadioScreen.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { SetStateAction, useState } from "react";
2+
import { useSafeAreaInsets } from "react-native-safe-area-context";
23
import {
34
Box,
45
Radio,
@@ -19,6 +20,7 @@ export const RadioScreen = () => {
1920
const [isDisabled, setIsDisabled] = useState<boolean>(false);
2021
const [isInvalid, setIsInvalid] = useState<boolean>(false);
2122
const [hasLabel, setHasLabel] = useState<boolean>(true);
23+
const safeAreaInsets = useSafeAreaInsets();
2224

2325
return (
2426
<Box style={tailwind.style("flex-1 justify-center bg-white-900")}>
@@ -71,7 +73,7 @@ export const RadioScreen = () => {
7173
</Box>
7274
<Box
7375
style={tailwind.style(
74-
"rounded-t-lg shadow-lg bg-gray-100 justify-end p-2",
76+
`rounded-t-lg shadow-lg bg-gray-100 justify-end px-2 pt-2 pb-[${safeAreaInsets.bottom}]`,
7577
)}
7678
>
7779
<RadioGroup

example/src/modules/forms/SelectScreen.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { SetStateAction, useState } from "react";
2+
import { useSafeAreaInsets } from "react-native-safe-area-context";
23
import {
34
Box,
45
CaretDown,
@@ -86,6 +87,7 @@ export const SelectScreen = () => {
8687
const [isSelectInvalid, setIsSelectInvalid] = useState<boolean>(false);
8788
const [isSelectDisabled, setIsSelectDisabled] = useState<boolean>(false);
8889
const [hasPrefix, setHasPrefix] = useState<boolean>(false);
90+
const safeAreaInsets = useSafeAreaInsets();
8991

9092
const [changeSuffix, setChangeSuffix] = useState(false);
9193

@@ -108,7 +110,7 @@ export const SelectScreen = () => {
108110
</Box>
109111
<Box
110112
style={tailwind.style(
111-
"rounded-t-lg shadow-lg bg-gray-100 justify-end p-2",
113+
`rounded-t-lg shadow-lg bg-gray-100 justify-end px-2 pt-2 pb-[${safeAreaInsets.bottom}]`,
112114
)}
113115
>
114116
<RadioGroup

0 commit comments

Comments
 (0)