Retrait des points-virgules finaux

This commit is contained in:
2024-12-07 10:24:41 +01:00
parent ab180a12ce
commit 2ad2063339
20 changed files with 101 additions and 103 deletions

View File

@ -1,7 +1,7 @@
import { ScrollView } from 'react-native';
import { ScrollView } from 'react-native'
import { ThemedText } from '@/components/ThemedText';
import { ThemedView } from '@/components/ThemedView';
import { ThemedText } from '@/components/ThemedText'
import { ThemedView } from '@/components/ThemedView'
export default function ChallengesScreen() {
return (
@ -10,5 +10,5 @@ export default function ChallengesScreen() {
<ThemedText>Ici on aura la gestion des challenges</ThemedText>
</ThemedView>
</ScrollView>
);
)
}

View File

@ -1,7 +1,6 @@
import { ScrollView } from 'react-native';
import { ThemedText } from '@/components/ThemedText';
import { ThemedView } from '@/components/ThemedView';
import { ScrollView } from 'react-native'
import { ThemedText } from '@/components/ThemedText'
import { ThemedView } from '@/components/ThemedView'
export default function HistoryScreen() {
return (
@ -10,5 +9,5 @@ export default function HistoryScreen() {
<ThemedText>Ici on aura la gestion de l'historique des trains empruntés et des challenges effectués</ThemedText>
</ThemedView>
</ScrollView>
);
)
}

View File

@ -27,4 +27,4 @@ const styles = StyleSheet.create({
flex: 1,
alignSelf: 'stretch',
},
});
})

View File

@ -1,7 +1,7 @@
import { ScrollView } from 'react-native';
import { ScrollView } from 'react-native'
import { ThemedText } from '@/components/ThemedText';
import { ThemedView } from '@/components/ThemedView';
import { ThemedText } from '@/components/ThemedText'
import { ThemedView } from '@/components/ThemedView'
export default function TrainScreen() {
return (
@ -10,5 +10,5 @@ export default function TrainScreen() {
<ThemedText>Ici on aura la page pour ajouter un trajet en train depuis Rail Planner</ThemedText>
</ThemedView>
</ScrollView>
);
)
}

View File

@ -1,12 +1,11 @@
import { Text, type TextProps, StyleSheet } from 'react-native';
import { useThemeColor } from '@/hooks/useThemeColor';
import { Text, type TextProps, StyleSheet } from 'react-native'
import { useThemeColor } from '@/hooks/useThemeColor'
export type ThemedTextProps = TextProps & {
lightColor?: string;
darkColor?: string;
type?: 'default' | 'title' | 'defaultSemiBold' | 'subtitle' | 'link';
};
lightColor?: string
darkColor?: string
type?: 'default' | 'title' | 'defaultSemiBold' | 'subtitle' | 'link'
}
export function ThemedText({
style,
@ -15,7 +14,7 @@ export function ThemedText({
type = 'default',
...rest
}: ThemedTextProps) {
const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text');
const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text')
return (
<Text
@ -30,7 +29,7 @@ export function ThemedText({
]}
{...rest}
/>
);
)
}
const styles = StyleSheet.create({
@ -57,4 +56,4 @@ const styles = StyleSheet.create({
fontSize: 16,
color: '#0a7ea4',
},
});
})

View File

@ -1,14 +1,13 @@
import { View, type ViewProps } from 'react-native';
import { useThemeColor } from '@/hooks/useThemeColor';
import { View, type ViewProps } from 'react-native'
import { useThemeColor } from '@/hooks/useThemeColor'
export type ThemedViewProps = ViewProps & {
lightColor?: string;
darkColor?: string;
};
lightColor?: string
darkColor?: string
}
export function ThemedView({ style, lightColor, darkColor, ...otherProps }: ThemedViewProps) {
const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background');
const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor }, 'background')
return <View style={[{ backgroundColor }, style]} {...otherProps} />;
return <View style={[{ backgroundColor }, style]} {...otherProps} />
}

View File

@ -1,10 +1,10 @@
import * as React from 'react';
import renderer from 'react-test-renderer';
import * as React from 'react'
import renderer from 'react-test-renderer'
import { ThemedText } from '../ThemedText';
import { ThemedText } from '../ThemedText'
it(`renders correctly`, () => {
const tree = renderer.create(<ThemedText>Snapshot test!</ThemedText>).toJSON();
const tree = renderer.create(<ThemedText>Snapshot test!</ThemedText>).toJSON()
expect(tree).toMatchSnapshot();
});
expect(tree).toMatchSnapshot()
})

View File

@ -21,4 +21,4 @@ exports[`renders correctly 1`] = `
>
Snapshot test!
</Text>
`;
`

View File

@ -3,8 +3,8 @@
* There are many other ways to style your app. For example, [Nativewind](https://www.nativewind.dev/), [Tamagui](https://tamagui.dev/), [unistyles](https://reactnativeunistyles.vercel.app), etc.
*/
const tintColorLight = '#0a7ea4';
const tintColorDark = '#fff';
const tintColorLight = '#0a7ea4'
const tintColorDark = '#fff'
export const Colors = {
light: {
@ -23,4 +23,4 @@ export const Colors = {
tabIconDefault: '#9BA1A6',
tabIconSelected: tintColorDark,
},
};
}

View File

@ -1 +1 @@
export { useColorScheme } from 'react-native';
export { useColorScheme } from 'react-native'

View File

@ -1,21 +1,21 @@
import { useEffect, useState } from 'react';
import { useColorScheme as useRNColorScheme } from 'react-native';
import { useEffect, useState } from 'react'
import { useColorScheme as useRNColorScheme } from 'react-native'
/**
* To support static rendering, this value needs to be re-calculated on the client side for web
*/
export function useColorScheme() {
const [hasHydrated, setHasHydrated] = useState(false);
const [hasHydrated, setHasHydrated] = useState(false)
useEffect(() => {
setHasHydrated(true);
}, []);
setHasHydrated(true)
}, [])
const colorScheme = useRNColorScheme();
const colorScheme = useRNColorScheme()
if (hasHydrated) {
return colorScheme;
return colorScheme
}
return 'light';
return 'light'
}

View File

@ -3,19 +3,19 @@
* https://docs.expo.dev/guides/color-schemes/
*/
import { Colors } from '@/constants/Colors';
import { useColorScheme } from '@/hooks/useColorScheme';
import { Colors } from '@/constants/Colors'
import { useColorScheme } from '@/hooks/useColorScheme'
export function useThemeColor(
props: { light?: string; dark?: string },
colorName: keyof typeof Colors.light & keyof typeof Colors.dark
) {
const theme = useColorScheme() ?? 'light';
const colorFromProps = props[theme];
const theme = useColorScheme() ?? 'light'
const colorFromProps = props[theme]
if (colorFromProps) {
return colorFromProps;
return colorFromProps
} else {
return Colors[theme][colorName];
return Colors[theme][colorName]
}
}