Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions demo/src/screens/componentScreens/ScreenFooterScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, {useState} from 'react';
import {StyleSheet, ScrollView} from 'react-native';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {
View,
Text,
Expand All @@ -21,6 +20,11 @@ import {
Icon
} from 'react-native-ui-lib';

let SafeAreaProvider: React.ComponentType<any> | undefined;
try {
SafeAreaProvider = require('react-native-safe-area-context').SafeAreaProvider;
} catch {}

// eslint-disable-next-line @typescript-eslint/no-var-requires
const basketIcon = require('../../assets/icons/collections.png');

Expand Down Expand Up @@ -93,7 +97,23 @@ const KEYBOARD_BEHAVIOR_OPTIONS_SPACED = [
{label: '', value: 'dummy'}
];

const ScreenFooterScreen = () => {
const MissingDependencyScreen = () => {
return (
<View flex center padding-s5>
<Text text60 $textDangerLight center>
Missing Dependency
</Text>
<Text text70 center marginT-s3>
This screen requires react-native-safe-area-context to be installed.
</Text>
<Text text80 $textNeutral center marginT-s2>
Run: npm/yarn install react-native-safe-area-context
</Text>
</View>
);
};

const ScreenFooterContent = () => {
const [itemsCount, setItemsCount] = useState(2);
const [layout, setLayout] = useState<ScreenFooterLayouts>(ScreenFooterLayouts.HORIZONTAL);
const [background, setBackground] = useState<ScreenFooterBackgrounds>(ScreenFooterBackgrounds.SOLID);
Expand Down Expand Up @@ -474,6 +494,14 @@ const ScreenFooterScreen = () => {
);
};

const ScreenFooterScreen = () => {
if (!SafeAreaProvider) {
return <MissingDependencyScreen />;
}

return <ScreenFooterContent />;
};

const styles = StyleSheet.create({
scrollContent: {
padding: 20,
Expand Down