@momo-kits/foundation 0.103.5 → 0.103.6
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/Input/InputOTP.tsx +8 -15
- package/Input/styles.ts +16 -0
- package/Layout/Screen.tsx +3 -2
- package/package.json +1 -1
package/Input/InputOTP.tsx
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
NativeSyntheticEvent,
|
|
13
13
|
TextInput,
|
|
14
14
|
TextInputFocusEventData,
|
|
15
|
-
TouchableOpacity,
|
|
16
15
|
View,
|
|
17
16
|
} from 'react-native';
|
|
18
17
|
import {ApplicationContext, ComponentContext} from '../Application';
|
|
@@ -94,17 +93,14 @@ const InputOTP = forwardRef(
|
|
|
94
93
|
onChangeText: (text: string) => {
|
|
95
94
|
_onChangeText(text);
|
|
96
95
|
},
|
|
97
|
-
focus: () =>
|
|
98
|
-
setFocused(true);
|
|
99
|
-
inputRef.current?.focus()
|
|
100
|
-
},
|
|
96
|
+
focus: () => inputRef.current?.focus(),
|
|
101
97
|
blur: () => inputRef.current?.blur(),
|
|
102
98
|
setText: (text: string) => _onChangeText(text),
|
|
103
99
|
}));
|
|
104
100
|
|
|
105
|
-
const onFocusInput = () => {
|
|
101
|
+
const onFocusInput = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
106
102
|
setFocused(true);
|
|
107
|
-
|
|
103
|
+
onFocus?.(e);
|
|
108
104
|
};
|
|
109
105
|
|
|
110
106
|
const onBlurInput = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
@@ -211,7 +207,7 @@ const InputOTP = forwardRef(
|
|
|
211
207
|
<View style={styles.otpInputsView}>
|
|
212
208
|
{length ? renderInputs(length) : renderUnidentifiedInputs()}
|
|
213
209
|
</View>
|
|
214
|
-
<View style={styles.
|
|
210
|
+
<View style={styles.otpRealInputWrapper}>
|
|
215
211
|
<TextInput
|
|
216
212
|
{...props}
|
|
217
213
|
accessibilityLabel={accessibilityLabel}
|
|
@@ -219,9 +215,9 @@ const InputOTP = forwardRef(
|
|
|
219
215
|
value={value}
|
|
220
216
|
onChangeText={_onChangeText}
|
|
221
217
|
keyboardType={dataType === 'number' ? 'number-pad' : 'default'}
|
|
222
|
-
onFocus={
|
|
218
|
+
onFocus={onFocusInput}
|
|
223
219
|
onBlur={onBlurInput}
|
|
224
|
-
style={
|
|
220
|
+
style={styles.otpRealInput}
|
|
225
221
|
selectionColor={theme.colors.primary}
|
|
226
222
|
placeholderTextColor={theme.colors.text.hint}
|
|
227
223
|
/>
|
|
@@ -239,17 +235,14 @@ const InputOTP = forwardRef(
|
|
|
239
235
|
state: 'enabled',
|
|
240
236
|
componentId: accessibilityLabel,
|
|
241
237
|
}}>
|
|
242
|
-
<
|
|
243
|
-
activeOpacity={1}
|
|
244
|
-
onPress={onFocusInput}
|
|
245
|
-
style={[style, styles.otpWrapper]}>
|
|
238
|
+
<View style={[style, styles.otpWrapper]}>
|
|
246
239
|
{renderInputView()}
|
|
247
240
|
<ErrorView
|
|
248
241
|
errorMessage={errorMessage}
|
|
249
242
|
errorSpacing={errorSpacing}
|
|
250
243
|
hintText={hintText}
|
|
251
244
|
/>
|
|
252
|
-
</
|
|
245
|
+
</View>
|
|
253
246
|
</ComponentContext.Provider>
|
|
254
247
|
);
|
|
255
248
|
}
|
package/Input/styles.ts
CHANGED
|
@@ -164,6 +164,22 @@ export default StyleSheet.create({
|
|
|
164
164
|
alignItems: 'center',
|
|
165
165
|
justifyContent: 'center',
|
|
166
166
|
},
|
|
167
|
+
otpRealInputWrapper: {
|
|
168
|
+
flex: 1,
|
|
169
|
+
flexDirection: 'row',
|
|
170
|
+
alignItems: 'center',
|
|
171
|
+
position: 'absolute',
|
|
172
|
+
width: '100%',
|
|
173
|
+
height: '100%',
|
|
174
|
+
opacity: 0.01,
|
|
175
|
+
backgroundColor: 'transparent',
|
|
176
|
+
},
|
|
177
|
+
otpRealInput: {
|
|
178
|
+
opacity: 0.01,
|
|
179
|
+
width: '100%',
|
|
180
|
+
height: '100%',
|
|
181
|
+
zIndex: 1,
|
|
182
|
+
},
|
|
167
183
|
|
|
168
184
|
//DropDown
|
|
169
185
|
inputDropDownWrapper: {
|
package/Layout/Screen.tsx
CHANGED
|
@@ -143,9 +143,10 @@ const Screen = forwardRef(
|
|
|
143
143
|
|
|
144
144
|
let handleScroll;
|
|
145
145
|
let Component: any = View;
|
|
146
|
-
|
|
146
|
+
|
|
147
|
+
let keyboardOffset = heightHeader - Math.min(insets.bottom, 21);
|
|
147
148
|
if (headerType === 'extended' || animatedHeader || inputSearchProps) {
|
|
148
|
-
keyboardOffset = -
|
|
149
|
+
keyboardOffset = -Math.min(insets.bottom, 21);
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
useEffect(() => {
|