Skip to content

Commit

Permalink
Merge branch 'main' into 8693had7c
Browse files Browse the repository at this point in the history
  • Loading branch information
JN0122 authored Apr 18, 2024
2 parents 974640f + a0022ee commit c54fb9f
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/components/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React from 'react';
import {
StyleSheet,
Text,
TextInput as ReactTextInput,
View,
} from 'react-native';

import { useTheme } from '@/hooks';

type Props = React.ComponentPropsWithRef<typeof ReactTextInput> & {
label: string;
secureTextEntry?: boolean;
onSubmit: (text: string) => void;
};

const TextInput = ({ label, secureTextEntry, onSubmit }: Props) => {
const { themedStyles } = useTheme();
return (
<View style={styles.container}>
<Text style={{ ...styles.label, color: themedStyles.text }}>{label}</Text>
<ReactTextInput
style={{
...styles.input,
backgroundColor: themedStyles.inputBackground,
color: themedStyles.text,
borderColor: themedStyles.inputBorder,
}}
secureTextEntry={secureTextEntry}
onSubmitEditing={(value) => onSubmit(value.nativeEvent.text)}
/>
</View>
);
};

const styles = StyleSheet.create({
container: {
marginBottom: 10,
},
label: {
fontSize: 16,
marginBottom: 5,
fontFamily: '',
},
input: {
borderWidth: 2.3,
borderRadius: 10,
width: 300,
height: 40,
padding: 10,
fontSize: 16,
},
});

export default TextInput;
1 change: 1 addition & 0 deletions src/components/TextInput/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as TextInput } from './TextInput';
7 changes: 7 additions & 0 deletions src/screens/Components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { globalStyles } from 'style';

import { PrimaryButton, SecondaryButton } from '@/components/Button';
import { ConversationTile } from '@/components/ConversationTile';
import { TextInput } from '@/components/TextInput';
import { SwitchTheme } from '@/components/Theme';
import { RootStackParamList } from '@/types/param';

Expand All @@ -16,12 +17,18 @@ const Home = ({ navigation }: Props) => {

return (
<View style={styles.container}>
<Text>Components screen</Text>
<Text>{t('Hello')}</Text>
<PrimaryButton
text="Wróć do Home Screen"
onPress={() => navigation.navigate('Home')}
/>
<PrimaryButton text="primary button" onPress={() => {}} />
<TextInput
label="Email"
placeholder="Enter your email"
onSubmit={(text) => console.log(text)}
/>
<SwitchTheme />
<ConversationTile
image={{
Expand Down
4 changes: 4 additions & 0 deletions style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ export const darkColors = {
text: '#FFFFFF',
textSecondary: '#FFFFFF',
textButtonSecondary: '#FFFFFF',
inputBackground: '#2d2d2d',
inputBorder: '#c7c4d6',
};

export const lightColors = {
background: '#FFFFFF',
text: '#010000',
textSecondary: '#73828A',
textButtonSecondary: '#7A7A7A',
inputBackground: '#f0f0f0',
inputBorder: '#c7c4d6',
};

0 comments on commit c54fb9f

Please sign in to comment.