@magmamath/students-features 0.9.0-rc11 → 0.9.0-rc13
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/dist/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.js +24 -16
- package/dist/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.js +15 -9
- package/dist/commonjs/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicExtendedLayout/keyboardGroups.js +11 -1
- package/dist/commonjs/features/keyboard/components/BasicExtendedLayout/keyboardGroups.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.js +15 -10
- package/dist/commonjs/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicExtendedPlusLayout/keyboardGroups.js +10 -2
- package/dist/commonjs/features/keyboard/components/BasicExtendedPlusLayout/keyboardGroups.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/BasicLayout.js +12 -0
- package/dist/commonjs/features/keyboard/components/BasicLayout/BasicLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/TimeBasicLayout.js +3 -8
- package/dist/commonjs/features/keyboard/components/BasicLayout/TimeBasicLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/keyboardGroup.js +5 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/keyboardGroup.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/Keyboard.js +6 -7
- package/dist/commonjs/features/keyboard/components/Keyboard.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/KeysList/KeysList.js +43 -23
- package/dist/commonjs/features/keyboard/components/KeysList/KeysList.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/Numpad/Numpad.js +18 -10
- package/dist/commonjs/features/keyboard/components/Numpad/Numpad.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/UnitsLayout.js +16 -10
- package/dist/commonjs/features/keyboard/components/UnitsLayout/UnitsLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/constants/keysValues.js +12 -2
- package/dist/commonjs/features/keyboard/constants/keysValues.js.map +1 -1
- package/dist/commonjs/features/keyboard/constants.js +2 -1
- package/dist/commonjs/features/keyboard/constants.js.map +1 -1
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/basicOperators.js +4 -2
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/basicOperators.js.map +1 -1
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/textSymbols.js +9 -9
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/textSymbols.js.map +1 -1
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/trigonometric.js +6 -6
- package/dist/commonjs/features/keyboard/types/types.js +2 -0
- package/dist/commonjs/features/keyboard/types/types.js.map +1 -1
- package/dist/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.js +25 -17
- package/dist/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.js +16 -10
- package/dist/module/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicExtendedLayout/keyboardGroups.js +10 -0
- package/dist/module/features/keyboard/components/BasicExtendedLayout/keyboardGroups.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.js +16 -11
- package/dist/module/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicExtendedPlusLayout/keyboardGroups.js +9 -1
- package/dist/module/features/keyboard/components/BasicExtendedPlusLayout/keyboardGroups.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicLayout/BasicLayout.js +13 -1
- package/dist/module/features/keyboard/components/BasicLayout/BasicLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicLayout/TimeBasicLayout.js +3 -8
- package/dist/module/features/keyboard/components/BasicLayout/TimeBasicLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicLayout/keyboardGroup.js +4 -0
- package/dist/module/features/keyboard/components/BasicLayout/keyboardGroup.js.map +1 -1
- package/dist/module/features/keyboard/components/Keyboard.js +6 -7
- package/dist/module/features/keyboard/components/Keyboard.js.map +1 -1
- package/dist/module/features/keyboard/components/KeysList/KeysList.js +44 -24
- package/dist/module/features/keyboard/components/KeysList/KeysList.js.map +1 -1
- package/dist/module/features/keyboard/components/Numpad/Numpad.js +19 -12
- package/dist/module/features/keyboard/components/Numpad/Numpad.js.map +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/UnitsLayout.js +17 -11
- package/dist/module/features/keyboard/components/UnitsLayout/UnitsLayout.js.map +1 -1
- package/dist/module/features/keyboard/constants/keysValues.js +16 -6
- package/dist/module/features/keyboard/constants/keysValues.js.map +1 -1
- package/dist/module/features/keyboard/constants.js +1 -0
- package/dist/module/features/keyboard/constants.js.map +1 -1
- package/dist/module/features/keyboard/types/MathKeysGroups/basicOperators.js +4 -2
- package/dist/module/features/keyboard/types/MathKeysGroups/basicOperators.js.map +1 -1
- package/dist/module/features/keyboard/types/MathKeysGroups/textSymbols.js +9 -9
- package/dist/module/features/keyboard/types/MathKeysGroups/textSymbols.js.map +1 -1
- package/dist/module/features/keyboard/types/MathKeysGroups/trigonometric.js +6 -6
- package/dist/module/features/keyboard/types/types.js +2 -0
- package/dist/module/features/keyboard/types/types.js.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicExtendedLayout/keyboardGroups.d.ts +2 -0
- package/dist/typescript/commonjs/features/keyboard/components/BasicExtendedLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicExtendedPlusLayout/keyboardGroups.d.ts +2 -0
- package/dist/typescript/commonjs/features/keyboard/components/BasicExtendedPlusLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicLayout/BasicLayout.d.ts +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicLayout/BasicLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicLayout/TimeBasicLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicLayout/keyboardGroup.d.ts +1 -0
- package/dist/typescript/commonjs/features/keyboard/components/BasicLayout/keyboardGroup.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/Keyboard.d.ts +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/Keyboard.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/KeysList/KeysList.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/Numpad/Numpad.d.ts +5 -1
- package/dist/typescript/commonjs/features/keyboard/components/Numpad/Numpad.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/UnitsLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/constants/keyboardLayouts.d.ts +2 -2
- package/dist/typescript/commonjs/features/keyboard/constants/keyboardLayouts.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/constants/keysValues.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/constants.d.ts +1 -0
- package/dist/typescript/commonjs/features/keyboard/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/types/MathKeysGroups/basicOperators.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/types/types.d.ts +6 -0
- package/dist/typescript/commonjs/features/keyboard/types/types.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicExtendedLayout/keyboardGroups.d.ts +2 -0
- package/dist/typescript/module/features/keyboard/components/BasicExtendedLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicExtendedPlusLayout/keyboardGroups.d.ts +2 -0
- package/dist/typescript/module/features/keyboard/components/BasicExtendedPlusLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicLayout/BasicLayout.d.ts +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicLayout/BasicLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicLayout/TimeBasicLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicLayout/keyboardGroup.d.ts +1 -0
- package/dist/typescript/module/features/keyboard/components/BasicLayout/keyboardGroup.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/Keyboard.d.ts +1 -1
- package/dist/typescript/module/features/keyboard/components/Keyboard.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/KeysList/KeysList.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/Numpad/Numpad.d.ts +5 -1
- package/dist/typescript/module/features/keyboard/components/Numpad/Numpad.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/UnitsLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/constants/keyboardLayouts.d.ts +2 -2
- package/dist/typescript/module/features/keyboard/constants/keyboardLayouts.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/constants/keysValues.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/constants.d.ts +1 -0
- package/dist/typescript/module/features/keyboard/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/types/MathKeysGroups/basicOperators.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/types/types.d.ts +6 -0
- package/dist/typescript/module/features/keyboard/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/keyboard/components/AlgebraLayout/AlgebraLayout.tsx +33 -21
- package/src/features/keyboard/components/BasicExtendedLayout/BasicExtendedLayout.tsx +15 -7
- package/src/features/keyboard/components/BasicExtendedLayout/keyboardGroups.tsx +54 -0
- package/src/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.tsx +18 -10
- package/src/features/keyboard/components/BasicExtendedPlusLayout/keyboardGroups.tsx +53 -1
- package/src/features/keyboard/components/BasicLayout/BasicLayout.tsx +13 -1
- package/src/features/keyboard/components/BasicLayout/TimeBasicLayout.tsx +3 -3
- package/src/features/keyboard/components/BasicLayout/keyboardGroup.ts +12 -0
- package/src/features/keyboard/components/Keyboard.tsx +8 -20
- package/src/features/keyboard/components/KeysList/KeysList.tsx +43 -22
- package/src/features/keyboard/components/Numpad/Numpad.tsx +15 -7
- package/src/features/keyboard/components/UnitsLayout/UnitsLayout.tsx +27 -19
- package/src/features/keyboard/constants/keysValues.ts +24 -2
- package/src/features/keyboard/constants.ts +2 -0
- package/src/features/keyboard/types/MathKeysGroups/basicOperators.tsx +2 -0
- package/src/features/keyboard/types/MathKeysGroups/textSymbols.tsx +9 -9
- package/src/features/keyboard/types/MathKeysGroups/trigonometric.tsx +6 -6
- package/src/features/keyboard/types/types.ts +6 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react'
|
|
2
2
|
import { KeysList } from '../KeysList/KeysList'
|
|
3
|
-
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import { StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
4
4
|
import { COLORS, SelectGroup, SelectOptionSize, IS_MOBILE } from '@magmamath/react-native-ui'
|
|
5
5
|
import { AlgebraIcon } from '../../../../shared/icons/AlgebraIcon'
|
|
6
6
|
import { IntegralABIcon } from '../../../../shared/icons/MATH/IntegralABIcon/IntegralABIcon'
|
|
7
7
|
import { Locale, useText } from '../../../../shared/translation'
|
|
8
8
|
import { KEYBOARD_GROUPS_BY_LOCALE } from '../../constants/keysValues'
|
|
9
9
|
import { KeyboardLayoutProps, KeyboardType } from '../../types/types'
|
|
10
|
+
import { MAX_WIDTH_FOR_MOBILE_LAYOUT } from '../../constants'
|
|
10
11
|
|
|
11
12
|
enum SelectedLayout {
|
|
12
13
|
BASIC = 'basic',
|
|
@@ -16,11 +17,14 @@ enum SelectedLayout {
|
|
|
16
17
|
export const AlgebraLayout = (props: KeyboardLayoutProps) => {
|
|
17
18
|
const [selectedLayout, setSelectedLayout] = useState<SelectedLayout>(SelectedLayout.BASIC)
|
|
18
19
|
const t = useText()
|
|
20
|
+
const { width } = useWindowDimensions()
|
|
19
21
|
|
|
20
22
|
const algebraKeyboardGroup =
|
|
21
23
|
KEYBOARD_GROUPS_BY_LOCALE[t('locale') as Locale][KeyboardType.AlgebraAdvanced]
|
|
22
24
|
const basicKeyboardGroup =
|
|
23
|
-
|
|
25
|
+
width > MAX_WIDTH_FOR_MOBILE_LAYOUT
|
|
26
|
+
? KEYBOARD_GROUPS_BY_LOCALE[t('locale') as Locale][KeyboardType.BasicExtendedPlus]
|
|
27
|
+
: KEYBOARD_GROUPS_BY_LOCALE[t('locale') as Locale][KeyboardType.BasicExtendedPlusMobile]
|
|
24
28
|
|
|
25
29
|
const KEYBOARD_GROUPS = useMemo(
|
|
26
30
|
() =>
|
|
@@ -40,15 +44,17 @@ export const AlgebraLayout = (props: KeyboardLayoutProps) => {
|
|
|
40
44
|
size={20}
|
|
41
45
|
/>
|
|
42
46
|
),
|
|
47
|
+
onPressIn: () => setSelectedLayout(SelectedLayout.BASIC),
|
|
43
48
|
key: '1',
|
|
44
49
|
},
|
|
45
50
|
{
|
|
46
51
|
title: (
|
|
47
52
|
<IntegralABIcon
|
|
48
53
|
color={selectedLayout === SelectedLayout.ALGEBRA ? COLORS.NEUTRAL_1 : COLORS.NEUTRAL_9}
|
|
49
|
-
size={
|
|
54
|
+
size={22}
|
|
50
55
|
/>
|
|
51
56
|
),
|
|
57
|
+
onPressIn: () => setSelectedLayout(SelectedLayout.ALGEBRA),
|
|
52
58
|
key: '2',
|
|
53
59
|
},
|
|
54
60
|
]
|
|
@@ -56,21 +62,20 @@ export const AlgebraLayout = (props: KeyboardLayoutProps) => {
|
|
|
56
62
|
|
|
57
63
|
return (
|
|
58
64
|
<View style={styles.container}>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/>
|
|
65
|
+
{width > MAX_WIDTH_FOR_MOBILE_LAYOUT && (
|
|
66
|
+
<SelectGroup
|
|
67
|
+
numOfRows={2}
|
|
68
|
+
options={selectOptions}
|
|
69
|
+
size={SelectOptionSize.SMALL}
|
|
70
|
+
style={{
|
|
71
|
+
container: styles.optionContainer,
|
|
72
|
+
}}
|
|
73
|
+
color={props.color}
|
|
74
|
+
selectedOptions={[
|
|
75
|
+
selectedLayout === SelectedLayout.BASIC ? selectOptions[0] : selectOptions[1],
|
|
76
|
+
]}
|
|
77
|
+
/>
|
|
78
|
+
)}
|
|
74
79
|
<KeysList
|
|
75
80
|
keys={KEYBOARD_GROUPS.get(selectedLayout)?.keys || []}
|
|
76
81
|
numOfRows={3}
|
|
@@ -78,9 +83,9 @@ export const AlgebraLayout = (props: KeyboardLayoutProps) => {
|
|
|
78
83
|
style={{
|
|
79
84
|
container: styles.keysContainer,
|
|
80
85
|
option: {
|
|
81
|
-
button: styles.keyButton,
|
|
86
|
+
button: width > MAX_WIDTH_FOR_MOBILE_LAYOUT ? styles.keyButton : styles.mobileKeyButton,
|
|
82
87
|
text: [styles.keyText, selectedLayout === SelectedLayout.ALGEBRA && { fontSize: 11 }],
|
|
83
|
-
|
|
88
|
+
container: IS_MOBILE ? { flexBasis: 53, maxWidth: 53 } : styles.keyContainer,
|
|
84
89
|
},
|
|
85
90
|
}}
|
|
86
91
|
/>
|
|
@@ -94,12 +99,15 @@ const styles = StyleSheet.create({
|
|
|
94
99
|
flexDirection: 'row',
|
|
95
100
|
gap: 16,
|
|
96
101
|
paddingRight: 16,
|
|
97
|
-
width: 575,
|
|
98
102
|
},
|
|
99
103
|
keyButton: {
|
|
100
104
|
minWidth: 43,
|
|
101
105
|
maxWidth: 58,
|
|
102
106
|
},
|
|
107
|
+
mobileKeyButton: {
|
|
108
|
+
width: 40,
|
|
109
|
+
paddingHorizontal: 12,
|
|
110
|
+
},
|
|
103
111
|
keyText: {
|
|
104
112
|
fontWeight: 700,
|
|
105
113
|
fontSize: 14,
|
|
@@ -107,6 +115,10 @@ const styles = StyleSheet.create({
|
|
|
107
115
|
keysContainer: {
|
|
108
116
|
gap: 9,
|
|
109
117
|
},
|
|
118
|
+
keyContainer: {
|
|
119
|
+
flexGrow: 0,
|
|
120
|
+
flexBasis: 'auto',
|
|
121
|
+
},
|
|
110
122
|
optionContainer: {
|
|
111
123
|
flexGrow: 0,
|
|
112
124
|
flexShrink: 0,
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { KeysList } from '../KeysList/KeysList'
|
|
3
|
-
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import { StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
4
4
|
import { KeyboardLayoutProps, KeyboardType } from '../../types/types'
|
|
5
|
-
import {
|
|
6
|
-
import { useText } from '../../../../shared/translation'
|
|
5
|
+
import { Locale, useText } from '../../../../shared/translation'
|
|
7
6
|
import { KEYBOARD_GROUPS_BY_LOCALE } from '../../constants/keysValues'
|
|
8
|
-
import {
|
|
7
|
+
import { IS_MOBILE } from '@magmamath/react-native-ui'
|
|
9
8
|
|
|
10
9
|
export const BasicExtendedLayout = (props: KeyboardLayoutProps) => {
|
|
11
10
|
const t = useText()
|
|
12
|
-
const
|
|
11
|
+
const { width } = useWindowDimensions()
|
|
12
|
+
const keysGroup =
|
|
13
|
+
width > 1180
|
|
14
|
+
? KEYBOARD_GROUPS_BY_LOCALE[t('locale') as Locale][KeyboardType.BasicExtended]
|
|
15
|
+
: KEYBOARD_GROUPS_BY_LOCALE[t('locale') as Locale][KeyboardType.BasicExtendedMobile]
|
|
13
16
|
|
|
14
17
|
return (
|
|
15
18
|
<View style={styles.container}>
|
|
@@ -21,7 +24,7 @@ export const BasicExtendedLayout = (props: KeyboardLayoutProps) => {
|
|
|
21
24
|
option: {
|
|
22
25
|
button: styles.option,
|
|
23
26
|
text: styles.text,
|
|
24
|
-
|
|
27
|
+
container: IS_MOBILE ? { flexBasis: 50 } : styles.optionContainer,
|
|
25
28
|
},
|
|
26
29
|
}}
|
|
27
30
|
{...props}
|
|
@@ -41,9 +44,14 @@ const styles = StyleSheet.create({
|
|
|
41
44
|
gap: 10,
|
|
42
45
|
},
|
|
43
46
|
option: {
|
|
44
|
-
|
|
47
|
+
width: 40,
|
|
48
|
+
},
|
|
49
|
+
optionContainer: {
|
|
50
|
+
flexGrow: 0,
|
|
51
|
+
flexBasis: 'auto',
|
|
45
52
|
},
|
|
46
53
|
text: {
|
|
47
54
|
fontStyle: 'italic',
|
|
55
|
+
fontWeight: 700,
|
|
48
56
|
},
|
|
49
57
|
})
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { MATH_BASIC_OPERATORS } from '../../types/MathKeysGroups/basicOperators'
|
|
2
2
|
import { MATH_TEXT_SYMBOLS } from '../../types/MathKeysGroups/textSymbols'
|
|
3
3
|
import { KeyboardGroup } from '../../types/types'
|
|
4
|
+
import { MATH_SYMBOLS } from '../../types/MathKeysGroups/symbols'
|
|
5
|
+
import { MATH_GEOMETRY_SYMBOLS } from '../../types/MathKeysGroups/geometry'
|
|
4
6
|
|
|
5
7
|
export const MATH_ENTRY_BASIC_SW_EXTENDED: KeyboardGroup = {
|
|
6
8
|
id: 'math-entry-basic-sw-extended',
|
|
@@ -24,6 +26,32 @@ export const MATH_ENTRY_BASIC_SW_EXTENDED: KeyboardGroup = {
|
|
|
24
26
|
],
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
export const MATH_ENTRY_BASIC_EXTENDED_MOBILE_SW: KeyboardGroup = {
|
|
30
|
+
id: 'math-entry-basic-extended-mobile-sw',
|
|
31
|
+
keys: [
|
|
32
|
+
MATH_BASIC_OPERATORS.ADDITION,
|
|
33
|
+
MATH_BASIC_OPERATORS.SUBTRACTION,
|
|
34
|
+
MATH_BASIC_OPERATORS.EQUALS,
|
|
35
|
+
MATH_BASIC_OPERATORS.PARENTHESES,
|
|
36
|
+
MATH_BASIC_OPERATORS.SQUARE_POWER,
|
|
37
|
+
MATH_BASIC_OPERATORS.SQUARE_ROOT,
|
|
38
|
+
MATH_BASIC_OPERATORS.GREATER_THAN,
|
|
39
|
+
MATH_BASIC_OPERATORS.C_DOT,
|
|
40
|
+
MATH_BASIC_OPERATORS.FRACTION,
|
|
41
|
+
MATH_BASIC_OPERATORS.DOT,
|
|
42
|
+
MATH_BASIC_OPERATORS.NTH_POWER,
|
|
43
|
+
MATH_BASIC_OPERATORS.NTH_ROOT,
|
|
44
|
+
MATH_SYMBOLS.PI,
|
|
45
|
+
MATH_BASIC_OPERATORS.LESS_THAN,
|
|
46
|
+
MATH_TEXT_SYMBOLS.X,
|
|
47
|
+
MATH_TEXT_SYMBOLS.Y,
|
|
48
|
+
MATH_TEXT_SYMBOLS.Z,
|
|
49
|
+
MATH_SYMBOLS.THETA,
|
|
50
|
+
MATH_GEOMETRY_SYMBOLS.DEGREE,
|
|
51
|
+
MATH_GEOMETRY_SYMBOLS.RADIAN,
|
|
52
|
+
],
|
|
53
|
+
}
|
|
54
|
+
|
|
27
55
|
export const MATH_ENTRY_BASIC_US_EXTENDED: KeyboardGroup = {
|
|
28
56
|
id: 'math-entry-basic-us-extended',
|
|
29
57
|
keys: [
|
|
@@ -45,3 +73,29 @@ export const MATH_ENTRY_BASIC_US_EXTENDED: KeyboardGroup = {
|
|
|
45
73
|
MATH_BASIC_OPERATORS.PERMILLE,
|
|
46
74
|
],
|
|
47
75
|
}
|
|
76
|
+
|
|
77
|
+
export const MATH_ENTRY_BASIC_EXTENDED_MOBILE: KeyboardGroup = {
|
|
78
|
+
id: 'math-entry-basic-extended-mobile',
|
|
79
|
+
keys: [
|
|
80
|
+
MATH_BASIC_OPERATORS.ADDITION,
|
|
81
|
+
MATH_BASIC_OPERATORS.SUBTRACTION,
|
|
82
|
+
MATH_BASIC_OPERATORS.EQUALS,
|
|
83
|
+
MATH_BASIC_OPERATORS.PARENTHESES,
|
|
84
|
+
MATH_BASIC_OPERATORS.SQUARE_POWER,
|
|
85
|
+
MATH_BASIC_OPERATORS.SQUARE_ROOT,
|
|
86
|
+
MATH_BASIC_OPERATORS.GREATER_THAN,
|
|
87
|
+
MATH_BASIC_OPERATORS.MULTIPLICATION,
|
|
88
|
+
MATH_BASIC_OPERATORS.FRACTION,
|
|
89
|
+
MATH_BASIC_OPERATORS.COMMA,
|
|
90
|
+
MATH_BASIC_OPERATORS.NTH_POWER,
|
|
91
|
+
MATH_BASIC_OPERATORS.NTH_ROOT,
|
|
92
|
+
MATH_SYMBOLS.PI,
|
|
93
|
+
MATH_BASIC_OPERATORS.LESS_THAN,
|
|
94
|
+
MATH_TEXT_SYMBOLS.X,
|
|
95
|
+
MATH_TEXT_SYMBOLS.Y,
|
|
96
|
+
MATH_TEXT_SYMBOLS.Z,
|
|
97
|
+
MATH_SYMBOLS.THETA,
|
|
98
|
+
MATH_GEOMETRY_SYMBOLS.DEGREE,
|
|
99
|
+
MATH_GEOMETRY_SYMBOLS.RADIAN,
|
|
100
|
+
],
|
|
101
|
+
}
|
package/src/features/keyboard/components/BasicExtendedPlusLayout/BasicExtendedPlusLayout.tsx
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { StyleSheet, View } from 'react-native'
|
|
2
|
+
import { StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
3
3
|
import { KeysList } from '../KeysList/KeysList'
|
|
4
4
|
import { KeyboardLayoutProps, KeyboardType } from '../../types/types'
|
|
5
5
|
import { IS_MOBILE } from '@magmamath/react-native-ui'
|
|
6
|
-
import { useText } from '../../../../shared/translation'
|
|
6
|
+
import { Locale, useText } from '../../../../shared/translation'
|
|
7
7
|
import { KEYBOARD_GROUPS_BY_LOCALE } from '../../constants/keysValues'
|
|
8
|
-
import { Locale } from '@magmamath/students-features'
|
|
9
8
|
|
|
10
9
|
export const BasicExtendedPlusLayout = (props: KeyboardLayoutProps) => {
|
|
11
10
|
const t = useText()
|
|
12
|
-
const
|
|
11
|
+
const { width } = useWindowDimensions()
|
|
12
|
+
const keysGroup =
|
|
13
|
+
width > 1180
|
|
14
|
+
? KEYBOARD_GROUPS_BY_LOCALE[t('locale') as Locale][KeyboardType.BasicExtendedPlus]
|
|
15
|
+
: KEYBOARD_GROUPS_BY_LOCALE[t('locale') as Locale][KeyboardType.BasicExtendedPlusMobile]
|
|
13
16
|
|
|
14
17
|
return (
|
|
15
18
|
<View style={styles.container}>
|
|
@@ -19,9 +22,9 @@ export const BasicExtendedPlusLayout = (props: KeyboardLayoutProps) => {
|
|
|
19
22
|
style={{
|
|
20
23
|
container: styles.keysContainer,
|
|
21
24
|
option: {
|
|
22
|
-
button: styles.
|
|
23
|
-
text: styles.
|
|
24
|
-
...(IS_MOBILE && { container:
|
|
25
|
+
button: styles.optionButton,
|
|
26
|
+
text: styles.optionText,
|
|
27
|
+
...(IS_MOBILE && { container: styles.optionContainer }),
|
|
25
28
|
},
|
|
26
29
|
}}
|
|
27
30
|
{...props}
|
|
@@ -40,10 +43,15 @@ const styles = StyleSheet.create({
|
|
|
40
43
|
keysContainer: {
|
|
41
44
|
gap: 10,
|
|
42
45
|
},
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
optionButton: {
|
|
47
|
+
width: 42,
|
|
45
48
|
},
|
|
46
|
-
|
|
49
|
+
optionContainer: {
|
|
50
|
+
flexBasis: 50,
|
|
51
|
+
maxWidth: 50,
|
|
52
|
+
},
|
|
53
|
+
optionText: {
|
|
54
|
+
fontWeight: 700,
|
|
47
55
|
fontStyle: 'italic',
|
|
48
56
|
},
|
|
49
57
|
})
|
|
@@ -36,6 +36,32 @@ export const MATH_ENTRY_BASIC_EXTENDED_PLUS: KeyboardGroup = {
|
|
|
36
36
|
],
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
export const MATH_ENTRY_BASIC_EXTENDED_PLUS_MOBILE: KeyboardGroup = {
|
|
40
|
+
id: 'math-entry-basic-extended-plus-mobile',
|
|
41
|
+
keys: [
|
|
42
|
+
MATH_BASIC_OPERATORS.ADDITION,
|
|
43
|
+
MATH_BASIC_OPERATORS.SUBTRACTION,
|
|
44
|
+
MATH_BASIC_OPERATORS.EQUALS,
|
|
45
|
+
MATH_BASIC_OPERATORS.PARENTHESES,
|
|
46
|
+
MATH_BASIC_OPERATORS.SQUARE_POWER,
|
|
47
|
+
MATH_BASIC_OPERATORS.SQUARE_ROOT,
|
|
48
|
+
MATH_BASIC_OPERATORS.GREATER_THAN,
|
|
49
|
+
MATH_BASIC_OPERATORS.MULTIPLICATION,
|
|
50
|
+
MATH_BASIC_OPERATORS.FRACTION,
|
|
51
|
+
MATH_BASIC_OPERATORS.COMMA,
|
|
52
|
+
MATH_BASIC_OPERATORS.NTH_POWER,
|
|
53
|
+
MATH_BASIC_OPERATORS.NTH_ROOT,
|
|
54
|
+
MATH_SYMBOLS.PI,
|
|
55
|
+
MATH_BASIC_OPERATORS.LESS_THAN,
|
|
56
|
+
MATH_TEXT_SYMBOLS.X,
|
|
57
|
+
MATH_TEXT_SYMBOLS.Y,
|
|
58
|
+
MATH_TEXT_SYMBOLS.Z,
|
|
59
|
+
MATH_SYMBOLS.THETA,
|
|
60
|
+
MATH_GEOMETRY_SYMBOLS.DEGREE,
|
|
61
|
+
MATH_GEOMETRY_SYMBOLS.RADIAN,
|
|
62
|
+
],
|
|
63
|
+
}
|
|
64
|
+
|
|
39
65
|
export const MATH_ENTRY_BASIC_EXTENDED_PLUS_SW: KeyboardGroup = {
|
|
40
66
|
id: 'math-entry-basic-extended-plus-sw',
|
|
41
67
|
keys: [
|
|
@@ -48,7 +74,7 @@ export const MATH_ENTRY_BASIC_EXTENDED_PLUS_SW: KeyboardGroup = {
|
|
|
48
74
|
MATH_BASIC_OPERATORS.PLUS_MINUS,
|
|
49
75
|
MATH_SYMBOLS.PI,
|
|
50
76
|
MATH_GEOMETRY_SYMBOLS.RADIAN,
|
|
51
|
-
MATH_BASIC_OPERATORS.
|
|
77
|
+
MATH_BASIC_OPERATORS.C_DOT,
|
|
52
78
|
MATH_BASIC_OPERATORS.FRACTION,
|
|
53
79
|
MATH_BASIC_OPERATORS.SLASH,
|
|
54
80
|
MATH_BASIC_OPERATORS.DOT,
|
|
@@ -67,3 +93,29 @@ export const MATH_ENTRY_BASIC_EXTENDED_PLUS_SW: KeyboardGroup = {
|
|
|
67
93
|
MATH_BASIC_OPERATORS.GREATER_THAN,
|
|
68
94
|
],
|
|
69
95
|
}
|
|
96
|
+
|
|
97
|
+
export const MATH_ENTRY_BASIC_EXTENDED_PLUS_MOBILE_SW: KeyboardGroup = {
|
|
98
|
+
id: 'math-entry-basic-extended-plus-mobile-sw',
|
|
99
|
+
keys: [
|
|
100
|
+
MATH_BASIC_OPERATORS.ADDITION,
|
|
101
|
+
MATH_BASIC_OPERATORS.SUBTRACTION,
|
|
102
|
+
MATH_BASIC_OPERATORS.EQUALS,
|
|
103
|
+
MATH_BASIC_OPERATORS.PARENTHESES,
|
|
104
|
+
MATH_BASIC_OPERATORS.SQUARE_POWER,
|
|
105
|
+
MATH_BASIC_OPERATORS.SQUARE_ROOT,
|
|
106
|
+
MATH_BASIC_OPERATORS.GREATER_THAN,
|
|
107
|
+
MATH_BASIC_OPERATORS.C_DOT,
|
|
108
|
+
MATH_BASIC_OPERATORS.FRACTION,
|
|
109
|
+
MATH_BASIC_OPERATORS.DOT,
|
|
110
|
+
MATH_BASIC_OPERATORS.NTH_POWER,
|
|
111
|
+
MATH_BASIC_OPERATORS.NTH_ROOT,
|
|
112
|
+
MATH_SYMBOLS.PI,
|
|
113
|
+
MATH_BASIC_OPERATORS.LESS_THAN,
|
|
114
|
+
MATH_TEXT_SYMBOLS.X,
|
|
115
|
+
MATH_TEXT_SYMBOLS.Y,
|
|
116
|
+
MATH_TEXT_SYMBOLS.Z,
|
|
117
|
+
MATH_SYMBOLS.THETA,
|
|
118
|
+
MATH_GEOMETRY_SYMBOLS.DEGREE,
|
|
119
|
+
MATH_GEOMETRY_SYMBOLS.RADIAN,
|
|
120
|
+
],
|
|
121
|
+
}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react'
|
|
2
2
|
import { KeysList } from '../KeysList/KeysList'
|
|
3
|
-
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import { StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
4
4
|
import { KeyboardLayoutProps } from '../../types/types'
|
|
5
5
|
import { MATH_ENTRY_BASIC_KEYBOARD_GROUP } from './keyboardGroup'
|
|
6
6
|
import { IS_MOBILE } from '@magmamath/react-native-ui'
|
|
7
|
+
import { MAX_WIDTH_FOR_MOBILE_LAYOUT } from '../../constants'
|
|
7
8
|
|
|
8
9
|
export const BasicLayout = (props: KeyboardLayoutProps & PropsWithChildren) => {
|
|
9
10
|
const keys = props.children
|
|
10
11
|
? MATH_ENTRY_BASIC_KEYBOARD_GROUP.keys
|
|
11
12
|
: MATH_ENTRY_BASIC_KEYBOARD_GROUP.keys.slice(0, -1)
|
|
13
|
+
const { width } = useWindowDimensions()
|
|
14
|
+
|
|
15
|
+
if (width <= MAX_WIDTH_FOR_MOBILE_LAYOUT && !props.children) {
|
|
16
|
+
return null
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
return (
|
|
13
20
|
<View style={styles.container}>
|
|
14
21
|
<KeysList
|
|
@@ -19,6 +26,7 @@ export const BasicLayout = (props: KeyboardLayoutProps & PropsWithChildren) => {
|
|
|
19
26
|
container: styles.keysContainer,
|
|
20
27
|
option: {
|
|
21
28
|
button: styles.keyOption,
|
|
29
|
+
text: styles.keyText,
|
|
22
30
|
...(IS_MOBILE && { container: { flexBasis: 45, maxWidth: 45 } }),
|
|
23
31
|
},
|
|
24
32
|
}}
|
|
@@ -44,4 +52,8 @@ const styles = StyleSheet.create({
|
|
|
44
52
|
keyOption: {
|
|
45
53
|
width: 42,
|
|
46
54
|
},
|
|
55
|
+
keyText: {
|
|
56
|
+
fontSize: 16,
|
|
57
|
+
fontWeight: 700,
|
|
58
|
+
},
|
|
47
59
|
})
|
|
@@ -5,7 +5,6 @@ import { BasicLayout } from './BasicLayout'
|
|
|
5
5
|
import { KeyboardLayoutProps, KeyboardType } from '../../types/types'
|
|
6
6
|
import { useText, Locale } from '../../../../shared/translation'
|
|
7
7
|
import { KEYBOARD_GROUPS_BY_LOCALE } from '../../constants/keysValues'
|
|
8
|
-
import { IS_MOBILE } from '@magmamath/react-native-ui'
|
|
9
8
|
|
|
10
9
|
export const TimeBasicLayout = (props: KeyboardLayoutProps) => {
|
|
11
10
|
const t = useText()
|
|
@@ -19,7 +18,7 @@ export const TimeBasicLayout = (props: KeyboardLayoutProps) => {
|
|
|
19
18
|
style={{
|
|
20
19
|
option: {
|
|
21
20
|
text: styles.keysText,
|
|
22
|
-
|
|
21
|
+
container: styles.optionContainer,
|
|
23
22
|
},
|
|
24
23
|
container: styles.keysContainer,
|
|
25
24
|
}}
|
|
@@ -31,7 +30,8 @@ export const TimeBasicLayout = (props: KeyboardLayoutProps) => {
|
|
|
31
30
|
|
|
32
31
|
const styles = StyleSheet.create({
|
|
33
32
|
optionContainer: {
|
|
34
|
-
|
|
33
|
+
flexBasis: 49,
|
|
34
|
+
maxWidth: 49,
|
|
35
35
|
},
|
|
36
36
|
keysContainer: {
|
|
37
37
|
gap: 9,
|
|
@@ -14,6 +14,18 @@ export const MATH_ENTRY_BASIC_KEYBOARD_GROUP: KeyboardGroup = {
|
|
|
14
14
|
],
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
export const MATH_ENTRY_BASIC_SW_KEYBOARD_GROUP: KeyboardGroup = {
|
|
18
|
+
id: 'math-entry-basic-sw',
|
|
19
|
+
keys: [
|
|
20
|
+
MATH_BASIC_OPERATORS.ADDITION,
|
|
21
|
+
MATH_BASIC_OPERATORS.SUBTRACTION,
|
|
22
|
+
MATH_BASIC_OPERATORS.EQUALS,
|
|
23
|
+
MATH_BASIC_OPERATORS.C_DOT,
|
|
24
|
+
MATH_BASIC_OPERATORS.DIVISION,
|
|
25
|
+
MATH_BASIC_OPERATORS.DOT,
|
|
26
|
+
],
|
|
27
|
+
}
|
|
28
|
+
|
|
17
29
|
export const MATH_TIME_SW_KEYBOARD_GROUP: KeyboardGroup = {
|
|
18
30
|
id: 'math-entry-time-sw',
|
|
19
31
|
numOfRows: 3,
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
Animated,
|
|
4
|
-
Easing,
|
|
5
|
-
StyleProp,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
useWindowDimensions,
|
|
8
|
-
ViewStyle,
|
|
9
|
-
} from 'react-native'
|
|
2
|
+
import { Animated, StyleProp, StyleSheet, useWindowDimensions, ViewStyle } from 'react-native'
|
|
10
3
|
import { COLORS, SelectOptionColor, SHADOWS } from '@magmamath/react-native-ui'
|
|
11
4
|
import { getLayoutByCharType, KEYBOARD_LAYOUTS } from '../constants/keyboardLayouts'
|
|
12
5
|
import { KeyboardKey, KeyboardKeyValue, KeyboardType } from '../types/types'
|
|
13
6
|
import { Numpad } from './Numpad/Numpad'
|
|
7
|
+
import { MAX_WIDTH_FOR_MOBILE_LAYOUT } from '../constants'
|
|
14
8
|
|
|
15
9
|
type KeyboardProps = {
|
|
16
10
|
onKeyPress: ({ katexValue, mathliveValue, isSpecialSymbol }: KeyboardKeyValue) => void
|
|
@@ -25,12 +19,12 @@ type KeyboardProps = {
|
|
|
25
19
|
|
|
26
20
|
export const Keyboard = ({ style, characterType, visible = true, ...props }: KeyboardProps) => {
|
|
27
21
|
const slideAnim = useRef(new Animated.Value(600)).current
|
|
28
|
-
const maxWidth =
|
|
29
|
-
characterType &&
|
|
30
|
-
KEYBOARD_LAYOUTS[KeyboardType.AlgebraAdvanced].characterTypes.includes(characterType)
|
|
31
|
-
? 1300
|
|
32
|
-
: 1180
|
|
33
22
|
const { width } = useWindowDimensions()
|
|
23
|
+
const Layout = getLayoutByCharType(characterType)
|
|
24
|
+
const isBasicMobileLayout =
|
|
25
|
+
characterType &&
|
|
26
|
+
width <= MAX_WIDTH_FOR_MOBILE_LAYOUT &&
|
|
27
|
+
KEYBOARD_LAYOUTS[KeyboardType.Basic].characterTypes.includes(characterType)
|
|
34
28
|
|
|
35
29
|
useEffect(() => {
|
|
36
30
|
Animated.spring(slideAnim, {
|
|
@@ -43,12 +37,6 @@ export const Keyboard = ({ style, characterType, visible = true, ...props }: Key
|
|
|
43
37
|
}).start()
|
|
44
38
|
}, [visible])
|
|
45
39
|
|
|
46
|
-
if (width < 820) {
|
|
47
|
-
return null
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const Layout = getLayoutByCharType(characterType)
|
|
51
|
-
|
|
52
40
|
return (
|
|
53
41
|
<Animated.View
|
|
54
42
|
style={[
|
|
@@ -60,7 +48,7 @@ export const Keyboard = ({ style, characterType, visible = true, ...props }: Key
|
|
|
60
48
|
]}
|
|
61
49
|
>
|
|
62
50
|
<Layout {...props} />
|
|
63
|
-
|
|
51
|
+
<Numpad {...props} withBorder={!isBasicMobileLayout} />
|
|
64
52
|
</Animated.View>
|
|
65
53
|
)
|
|
66
54
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { StyleProp, StyleSheet, ViewStyle } from 'react-native'
|
|
2
|
+
import { GestureResponderEvent, Platform, StyleProp, StyleSheet, ViewStyle } from 'react-native'
|
|
3
3
|
import {
|
|
4
4
|
ButtonStyle,
|
|
5
5
|
SelectGroup,
|
|
@@ -20,6 +20,8 @@ type KeysListProps = {
|
|
|
20
20
|
}
|
|
21
21
|
} & KeyboardLayoutProps
|
|
22
22
|
|
|
23
|
+
const isIOSWeb = Platform.OS === 'web' && /iPad|iPhone|iPod/.test(navigator.userAgent)
|
|
24
|
+
|
|
23
25
|
export const KeysList = ({
|
|
24
26
|
keys,
|
|
25
27
|
numOfRows,
|
|
@@ -33,35 +35,46 @@ export const KeysList = ({
|
|
|
33
35
|
<SelectGroup
|
|
34
36
|
style={{
|
|
35
37
|
container: [styles.container, style?.container],
|
|
36
|
-
row:
|
|
38
|
+
row: styles.row,
|
|
37
39
|
option: {
|
|
38
|
-
container:
|
|
39
|
-
flexGrow: 0,
|
|
40
|
-
flexShrink: 0,
|
|
41
|
-
flexBasis: 'auto',
|
|
42
|
-
},
|
|
40
|
+
container: styles.optionContainer,
|
|
43
41
|
...style?.option,
|
|
44
42
|
},
|
|
45
43
|
}}
|
|
46
44
|
numOfRows={numOfRows}
|
|
47
45
|
color={SelectOptionColor.GREY}
|
|
48
46
|
disabled={isDisabled}
|
|
49
|
-
options={keys.map((key
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
options={keys.map((key) => {
|
|
48
|
+
const pressHandler = (e: GestureResponderEvent) => {
|
|
49
|
+
onKeyPress?.({
|
|
50
|
+
event: e,
|
|
51
|
+
katexValue: key.katexValue,
|
|
52
|
+
mathliveValue: key.mathliveValue,
|
|
53
|
+
spreadsheetValue: key.spreadsheetValue,
|
|
54
|
+
isSpecialSymbol: key.isSpecialSymbol,
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
key: key.katexValue,
|
|
60
|
+
title: key.icon ? key.icon : key.label,
|
|
61
|
+
delayPressIn: 0,
|
|
62
|
+
onPressIn: (e) => {
|
|
63
|
+
onKeyPress?.({
|
|
64
|
+
event: e,
|
|
65
|
+
katexValue: key.katexValue,
|
|
66
|
+
mathliveValue: key.mathliveValue,
|
|
67
|
+
spreadsheetValue: key.spreadsheetValue,
|
|
68
|
+
isSpecialSymbol: key.isSpecialSymbol,
|
|
69
|
+
})
|
|
70
|
+
},
|
|
71
|
+
...(isIOSWeb ? { onPress: pressHandler } : { onPressIn: pressHandler }),
|
|
72
|
+
disabled:
|
|
73
|
+
(isSpecialButtonsDisabled && DISABLED_KEYS.includes(key)) ||
|
|
74
|
+
disabledKeys?.includes(key),
|
|
75
|
+
}
|
|
76
|
+
})}
|
|
55
77
|
size={SelectOptionSize.SMALL}
|
|
56
|
-
onOptionChange={(option) => {
|
|
57
|
-
const key = keys.find((k) => k.katexValue === option.key)
|
|
58
|
-
if (!key) return
|
|
59
|
-
onKeyPress?.({
|
|
60
|
-
katexValue: key.katexValue,
|
|
61
|
-
mathliveValue: key.mathliveValue,
|
|
62
|
-
isSpecialSymbol: key.isSpecialSymbol,
|
|
63
|
-
})
|
|
64
|
-
}}
|
|
65
78
|
/>
|
|
66
79
|
)
|
|
67
80
|
}
|
|
@@ -71,4 +84,12 @@ const styles = StyleSheet.create({
|
|
|
71
84
|
width: 'auto',
|
|
72
85
|
gap: 9,
|
|
73
86
|
},
|
|
87
|
+
row: {
|
|
88
|
+
gap: 3,
|
|
89
|
+
},
|
|
90
|
+
optionContainer: {
|
|
91
|
+
flexGrow: 0,
|
|
92
|
+
flexShrink: 0,
|
|
93
|
+
flexBasis: 'auto',
|
|
94
|
+
},
|
|
74
95
|
})
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { KeysList } from '../KeysList/KeysList'
|
|
3
3
|
import { StyleSheet, View } from 'react-native'
|
|
4
|
-
import { COLORS, SPACING } from '@magmamath/react-native-ui'
|
|
4
|
+
import { COLORS, SPACING, IS_MOBILE } from '@magmamath/react-native-ui'
|
|
5
5
|
import { KeyboardLayoutProps, KeyboardType } from '../../types/types'
|
|
6
6
|
import { Locale, useText } from '../../../../shared/translation'
|
|
7
7
|
import { getKeyboardGroup } from '../../helpers'
|
|
8
|
-
import { IS_MOBILE } from '@magmamath/react-native-ui'
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
type NumpadProps = {
|
|
10
|
+
withBorder?: boolean
|
|
11
|
+
} & KeyboardLayoutProps
|
|
12
|
+
|
|
13
|
+
export const Numpad = ({ withBorder = true, ...props }: NumpadProps) => {
|
|
11
14
|
const t = useText()
|
|
12
15
|
const keyboardGroup = getKeyboardGroup(t('locale') as Locale, KeyboardType.Numpad)
|
|
13
16
|
|
|
14
17
|
return (
|
|
15
|
-
<View style={styles.container}>
|
|
18
|
+
<View style={[styles.container, withBorder && { borderColor: COLORS.NEUTRAL_3 }]}>
|
|
16
19
|
<KeysList
|
|
17
20
|
keys={keyboardGroup.keys}
|
|
18
21
|
numOfRows={3}
|
|
@@ -21,7 +24,7 @@ export const Numpad = (props: KeyboardLayoutProps) => {
|
|
|
21
24
|
option: {
|
|
22
25
|
text: styles.keyText,
|
|
23
26
|
button: styles.keyButton,
|
|
24
|
-
|
|
27
|
+
container: IS_MOBILE ? { flexBasis: 45 } : styles.optionContainer,
|
|
25
28
|
},
|
|
26
29
|
}}
|
|
27
30
|
{...props}
|
|
@@ -33,8 +36,9 @@ export const Numpad = (props: KeyboardLayoutProps) => {
|
|
|
33
36
|
const styles = StyleSheet.create({
|
|
34
37
|
container: {
|
|
35
38
|
borderLeftWidth: 1,
|
|
36
|
-
borderColor:
|
|
39
|
+
borderColor: 'transparent',
|
|
37
40
|
paddingLeft: SPACING[800],
|
|
41
|
+
marginLeft: 'auto',
|
|
38
42
|
},
|
|
39
43
|
keysContainer: {
|
|
40
44
|
display: 'flex',
|
|
@@ -49,6 +53,10 @@ const styles = StyleSheet.create({
|
|
|
49
53
|
fontWeight: 700,
|
|
50
54
|
},
|
|
51
55
|
keyButton: {
|
|
52
|
-
width:
|
|
56
|
+
width: 40,
|
|
57
|
+
},
|
|
58
|
+
optionContainer: {
|
|
59
|
+
flexGrow: 0,
|
|
60
|
+
flexBasis: 'auto',
|
|
53
61
|
},
|
|
54
62
|
})
|