Skip to content
Merged
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
38 changes: 25 additions & 13 deletions apps/common-app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @eslint-react/no-nested-component-definitions */
/* eslint-disable @eslint-react/no-nested-components */
Comment thread
j-piasecki marked this conversation as resolved.
Comment thread
m-bert marked this conversation as resolved.
import AsyncStorage from '@react-native-async-storage/async-storage';
import type { ParamListBase } from '@react-navigation/native';
import { NavigationContainer } from '@react-navigation/native';
Expand All @@ -11,8 +13,8 @@ import { useEffect, useState } from 'react';
import { Dimensions, Platform, StyleSheet, Text, View } from 'react-native';
import {
GestureHandlerRootView,
RectButton,
Switch,
Touchable,
} from 'react-native-gesture-handler';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
Comment thread
j-piasecki marked this conversation as resolved.

Expand Down Expand Up @@ -123,7 +125,7 @@ export default function App() {
<MainScreenItem
name={item.name}
onPressItem={(name) => navigate(navigation, name)}
enabled={!item.unsupportedPlatforms?.has(Platform.OS)}
disabled={!!item.unsupportedPlatforms?.has(Platform.OS)}
/>
)}
renderSectionHeader={({ section: { sectionTitle } }) => (
Expand Down Expand Up @@ -156,7 +158,9 @@ export default function App() {
}
return (
<View style={styles.settings}>
<RectButton
<Touchable
androidRipple={{}}
activeUnderlayOpacity={Platform.OS !== 'android' ? 0.1 : 0}
style={styles.settingsButton}
onPress={() => {
updateKeepSetting(!openLastExample);
Expand All @@ -175,8 +179,10 @@ export default function App() {
}}
/>
</View>
</RectButton>
<RectButton
</Touchable>
<Touchable
androidRipple={{}}
activeUnderlayOpacity={Platform.OS !== 'android' ? 0.1 : 0}
style={styles.settingsButton}
onPress={() => {
updateVersionSetting(!showLegacyVersion);
Expand All @@ -195,28 +201,34 @@ export default function App() {
}}
/>
</View>
</RectButton>
</Touchable>
</View>
);
}

interface MainScreenItemProps {
name: string;
onPressItem: (name: string) => void;
enabled: boolean;
disabled: boolean;
}

function MainScreenItem({ name, onPressItem, enabled }: MainScreenItemProps) {
function MainScreenItem({
name,
onPressItem,
disabled,
}: MainScreenItemProps) {
return (
<RectButton
enabled={enabled}
style={[styles.button, !enabled && styles.unavailableExample]}
<Touchable
disabled={disabled}
style={[styles.button, disabled && styles.unavailableExample]}
androidRipple={{}}
activeUnderlayOpacity={Platform.OS !== 'android' ? 0.1 : 0}
onPress={() => onPressItem(name)}>
<Text style={styles.text}>{name}</Text>
{Platform.OS !== 'macos' && enabled && (
{Platform.OS !== 'macos' && !disabled && (
<Icon name="chevron-small-right" size={24} color="#bbb" />
)}
</RectButton>
</Touchable>
);
}
}
Expand Down
Loading