@momo-kits/stepper 0.153.2 → 0.154.1-beta.1

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.
Files changed (3) hide show
  1. package/NumberView.tsx +24 -10
  2. package/package.json +1 -1
  3. package/styles.ts +3 -15
package/NumberView.tsx CHANGED
@@ -1,7 +1,7 @@
1
- import React, {FC, useContext} from 'react';
2
- import {TextInput, View} from 'react-native';
3
- import {StepperValueProps} from './types';
4
- import {ApplicationContext} from '@momo-kits/foundation';
1
+ import React, { FC, useContext } from 'react';
2
+ import { TextInput, View } from 'react-native';
3
+ import { StepperValueProps } from './types';
4
+ import { ApplicationContext, useScaleSize } from '@momo-kits/foundation';
5
5
  import styles from './styles';
6
6
 
7
7
  const NumberView: FC<StepperValueProps> = ({
@@ -12,9 +12,10 @@ const NumberView: FC<StepperValueProps> = ({
12
12
  disabled,
13
13
  componentId,
14
14
  }) => {
15
- const {theme} = useContext(ApplicationContext);
16
- const sizeStyle =
17
- size === 'large' ? styles.numberView : styles.numberViewSmall;
15
+ const { theme } = useContext(ApplicationContext);
16
+ const scaledHeight28 = useScaleSize(28);
17
+ const scaledHeight24 = useScaleSize(24);
18
+ const scaledFontSize = useScaleSize(12);
18
19
 
19
20
  const formattedNumber = (value: number) => {
20
21
  if (isNaN(value)) {
@@ -32,16 +33,29 @@ const NumberView: FC<StepperValueProps> = ({
32
33
  ? theme.colors.border.disable
33
34
  : theme.colors.border.default;
34
35
  return (
35
- <View style={[sizeStyle, {borderColor}]}>
36
+ <View
37
+ style={[
38
+ styles.numberViewBase,
39
+ size === 'large'
40
+ ? { minWidth: 32, height: scaledHeight28 }
41
+ : { minWidth: 28, height: scaledHeight24 },
42
+ { borderColor },
43
+ ]}
44
+ >
36
45
  <TextInput
46
+ allowFontScaling={false}
37
47
  editable={editable}
38
- style={[styles.input, {color: textColor}]}
48
+ style={[
49
+ styles.numberViewInput,
50
+ { fontSize: scaledFontSize },
51
+ { color: textColor },
52
+ ]}
39
53
  value={formattedNumber(value)}
40
54
  onChangeText={onValueChange}
41
55
  keyboardType={'number-pad'}
42
56
  selectionColor={theme.colors.primary}
43
57
  accessibilityLabel={`${componentId}|input`}
44
- accessibilityState={{disabled}}
58
+ accessibilityState={{ disabled }}
45
59
  />
46
60
  </View>
47
61
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/stepper",
3
- "version": "0.153.2",
3
+ "version": "0.154.1-beta.1",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "peerDependencies": {
package/styles.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import {StyleSheet} from 'react-native';
2
- import {Colors, Radius, scaleSize, Spacing} from '@momo-kits/foundation';
2
+ import {Colors, Radius, Spacing} from '@momo-kits/foundation';
3
3
 
4
4
  export default StyleSheet.create({
5
5
  button: {
@@ -30,26 +30,14 @@ export default StyleSheet.create({
30
30
  flexDirection: 'row',
31
31
  alignItems: 'center',
32
32
  },
33
- numberView: {
34
- minWidth: 32,
35
- height: scaleSize(28),
33
+ numberViewBase: {
36
34
  borderWidth: 1,
37
35
  borderRadius: Radius.S,
38
36
  justifyContent: 'center',
39
37
  alignItems: 'center',
40
38
  marginHorizontal: Spacing.S,
41
39
  },
42
- numberViewSmall: {
43
- minWidth: 28,
44
- height: scaleSize(24),
45
- borderWidth: 1,
46
- borderRadius: Radius.S,
47
- justifyContent: 'center',
48
- alignItems: 'center',
49
- marginHorizontal: Spacing.S,
50
- },
51
- input: {
52
- fontSize: scaleSize(12),
40
+ numberViewInput: {
53
41
  paddingVertical: 0,
54
42
  textAlign: 'center',
55
43
  },