@computools/react-native-template-controller 1.0.41 → 1.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@computools/react-native-template-controller",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
4
4
  "description": "Computools react native template by using mobx as controllers",
5
5
  "main": "template.config.js",
6
6
  "scripts": {
@@ -12,6 +12,7 @@ import {InputField} from '@ui-kit/InputField.component';
12
12
  import {Button} from '@ui-kit/buttons/Button.component';
13
13
  import {localization} from '@localization/localization';
14
14
  import {Computools} from '@ui-kit/icons/computools/Computools.icon';
15
+ import {KeyboardView} from '@ui-kit/keyboard-view/keyboard-view.component';
15
16
  import {MainStackParamsList, MainStackRoutes} from '@infra/MainStackRoutes.routes';
16
17
 
17
18
  enum LoginField {
@@ -71,7 +72,7 @@ export const Login: React.FC<NativeStackScreenProps<MainStackParamsList, MainSta
71
72
  );
72
73
 
73
74
  return (
74
- <View style={styles.screen}>
75
+ <KeyboardView style={styles.screen}>
75
76
  <View style={[styles.headerContainer, styles.row]}>
76
77
  <View style={styles.iconWrapper}>
77
78
  <Computools />
@@ -83,16 +84,14 @@ export const Login: React.FC<NativeStackScreenProps<MainStackParamsList, MainSta
83
84
  <Text style={[styles.forgetPassword, styles.row]}>{localization.t('forgotPass')}</Text>
84
85
  <Button style={styles.row} onPress={handleSubmit(onLogin)} text={localization.t('buttons.login')} />
85
86
  <Button style={styles.row} onPress={onSignUp} text={localization.t('buttons.signup')} />
86
- </View>
87
+ </KeyboardView>
87
88
  );
88
89
  };
89
90
 
90
91
  const styles = StyleSheet.create({
91
92
  screen: {
92
- flex: 1,
93
93
  justifyContent: 'center',
94
94
  paddingHorizontal: 30,
95
- paddingTop: 25,
96
95
  },
97
96
  headerContainer: {
98
97
  alignItems: 'center',
@@ -1,8 +1,8 @@
1
1
  import {z} from 'zod';
2
2
  import React from 'react';
3
3
  import {zodResolver} from '@hookform/resolvers/zod';
4
+ import {View, Text, StyleSheet, Alert} from 'react-native';
4
5
  import {useForm, Controller, ControllerProps} from 'react-hook-form';
5
- import {View, Text, StyleSheet, Alert, SafeAreaView} from 'react-native';
6
6
  import {type NativeStackScreenProps} from '@react-navigation/native-stack';
7
7
 
8
8
  import {InputField} from '@ui-kit/InputField.component';
@@ -10,6 +10,7 @@ import {Button} from '@ui-kit/buttons/Button.component';
10
10
  import {HeaderBack} from '@ui-kit/HeaderBack.component';
11
11
  import {localization} from '@localization/localization';
12
12
  import {Computools} from '@ui-kit/icons/computools/Computools.icon';
13
+ import {KeyboardView} from '@ui-kit/keyboard-view/keyboard-view.component';
13
14
  import {MainStackParamsList, MainStackRoutes} from '@infra/MainStackRoutes.routes';
14
15
 
15
16
  enum SignUpField {
@@ -77,7 +78,7 @@ export const SignUp: React.FC<NativeStackScreenProps<MainStackParamsList, MainSt
77
78
  );
78
79
 
79
80
  return (
80
- <SafeAreaView style={styles.safeArea}>
81
+ <KeyboardView>
81
82
  <HeaderBack goBack={navigation.goBack} />
82
83
  <View style={styles.screen}>
83
84
  <View style={[styles.headerContainer, styles.row]}>
@@ -91,14 +92,11 @@ export const SignUp: React.FC<NativeStackScreenProps<MainStackParamsList, MainSt
91
92
  <Controller name={SignUpField.RepeatPassword} control={control} render={renderRepeatPassword} />
92
93
  <Button style={styles.row} onPress={handleSubmit(onSignUp)} text={localization.t('buttons.signup')} />
93
94
  </View>
94
- </SafeAreaView>
95
+ </KeyboardView>
95
96
  );
96
97
  };
97
98
 
98
99
  const styles = StyleSheet.create({
99
- safeArea: {
100
- flex: 1,
101
- },
102
100
  screen: {
103
101
  flex: 1,
104
102
  justifyContent: 'center',
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import {useSafeAreaInsets} from 'react-native-safe-area-context';
3
+ import {Keyboard, KeyboardAvoidingView, KeyboardAvoidingViewProps, Platform, StyleSheet} from 'react-native';
4
+
5
+ export const KeyboardView: React.FC<KeyboardAvoidingViewProps> = ({children, style, ...props}) => {
6
+ const {top} = useSafeAreaInsets();
7
+
8
+ return (
9
+ <KeyboardAvoidingView
10
+ onTouchStart={Keyboard.dismiss}
11
+ style={[styles.keyboardView, {paddingTop: top}, style]}
12
+ behavior={Platform.select({ios: 'padding', android: 'height'})}
13
+ {...props}>
14
+ {children}
15
+ </KeyboardAvoidingView>
16
+ );
17
+ };
18
+
19
+ const styles = StyleSheet.create({
20
+ keyboardView: {flex: 1},
21
+ });