@khanacademy/math-input 0.0.0-PR442-20230403162612
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/.eslintrc.js +12 -0
- package/CHANGELOG.md +117 -0
- package/README.md +39 -0
- package/dist/components/common-style.d.ts +21 -0
- package/dist/components/common-style.js.flow +27 -0
- package/dist/components/input/cursor-contexts.d.ts +19 -0
- package/dist/components/input/cursor-contexts.js.flow +32 -0
- package/dist/components/input/cursor-handle.d.ts +25 -0
- package/dist/components/input/cursor-handle.js.flow +28 -0
- package/dist/components/input/math-input.d.ts +128 -0
- package/dist/components/input/math-input.js.flow +152 -0
- package/dist/components/keypad/button-assets.d.ts +6 -0
- package/dist/components/keypad/button-assets.js.flow +12 -0
- package/dist/components/keypad/button.d.ts +13 -0
- package/dist/components/keypad/button.js.flow +18 -0
- package/dist/components/keypad/index.d.ts +15 -0
- package/dist/components/keypad/index.js.flow +22 -0
- package/dist/components/keypad/keypad-page-items.d.ts +23 -0
- package/dist/components/keypad/keypad-page-items.js.flow +29 -0
- package/dist/components/keypad/numeric-input-page.d.ts +8 -0
- package/dist/components/keypad/numeric-input-page.js.flow +13 -0
- package/dist/components/keypad/pre-algebra-page.d.ts +8 -0
- package/dist/components/keypad/pre-algebra-page.js.flow +13 -0
- package/dist/components/keypad/trigonometry-page.d.ts +8 -0
- package/dist/components/keypad/trigonometry-page.js.flow +15 -0
- package/dist/components/provided-keypad.d.ts +23 -0
- package/dist/components/provided-keypad.js.flow +32 -0
- package/dist/components/tabbar/icons.d.ts +7 -0
- package/dist/components/tabbar/icons.js.flow +13 -0
- package/dist/components/tabbar/item.d.ts +14 -0
- package/dist/components/tabbar/item.js.flow +20 -0
- package/dist/components/tabbar/tabbar.d.ts +14 -0
- package/dist/components/tabbar/tabbar.js.flow +20 -0
- package/dist/components/tabbar/types.d.ts +1 -0
- package/dist/components/tabbar/types.js.flow +7 -0
- package/dist/components/z-indexes.d.ts +7 -0
- package/dist/components/z-indexes.js.flow +13 -0
- package/dist/consts.d.ts +51 -0
- package/dist/consts.js.flow +66 -0
- package/dist/data/key-configs.d.ts +7 -0
- package/dist/data/key-configs.js.flow +13 -0
- package/dist/data/keys.d.ts +57 -0
- package/dist/data/keys.js.flow +112 -0
- package/dist/es/index.css +587 -0
- package/dist/es/index.js +7382 -0
- package/dist/es/index.js.map +1 -0
- package/dist/fake-react-native-web/index.d.ts +10 -0
- package/dist/fake-react-native-web/index.js.flow +8 -0
- package/dist/fake-react-native-web/text.d.ts +12 -0
- package/dist/fake-react-native-web/text.js.flow +18 -0
- package/dist/fake-react-native-web/view.d.ts +22 -0
- package/dist/fake-react-native-web/view.js.flow +28 -0
- package/dist/index.css +587 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +7331 -0
- package/dist/index.js.flow +20 -0
- package/dist/index.js.map +1 -0
- package/dist/store/index.d.ts +1 -0
- package/dist/store/index.js.flow +7 -0
- package/dist/strings.js +71 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js.flow +7 -0
- package/index.html +20 -0
- package/less/echo.less +56 -0
- package/less/main.less +5 -0
- package/less/overrides.less +129 -0
- package/less/popover.less +22 -0
- package/less/tabbar.less +6 -0
- package/package.json +64 -0
- package/src/actions/index.js +57 -0
- package/src/components/__tests__/gesture-state-machine_test.js +437 -0
- package/src/components/__tests__/node-manager_test.js +89 -0
- package/src/components/__tests__/two-page-keypad_test.js +42 -0
- package/src/components/app.js +73 -0
- package/src/components/common-style.ts +46 -0
- package/src/components/compute-layout-parameters.js +157 -0
- package/src/components/corner-decal.js +56 -0
- package/src/components/echo-manager.js +160 -0
- package/src/components/empty-keypad-button.js +49 -0
- package/src/components/expression-keypad.js +323 -0
- package/src/components/fraction-keypad.js +176 -0
- package/src/components/gesture-manager.js +226 -0
- package/src/components/gesture-state-machine.js +283 -0
- package/src/components/icon.js +74 -0
- package/src/components/iconography/arrow.js +22 -0
- package/src/components/iconography/backspace.js +29 -0
- package/src/components/iconography/cdot.js +29 -0
- package/src/components/iconography/cos.js +30 -0
- package/src/components/iconography/cube-root.js +36 -0
- package/src/components/iconography/dismiss.js +25 -0
- package/src/components/iconography/divide.js +34 -0
- package/src/components/iconography/down.js +16 -0
- package/src/components/iconography/equal.js +33 -0
- package/src/components/iconography/exp-2.js +29 -0
- package/src/components/iconography/exp-3.js +29 -0
- package/src/components/iconography/exp.js +29 -0
- package/src/components/iconography/frac.js +44 -0
- package/src/components/iconography/geq.js +33 -0
- package/src/components/iconography/gt.js +33 -0
- package/src/components/iconography/index.js +45 -0
- package/src/components/iconography/jump-into-numerator.js +41 -0
- package/src/components/iconography/jump-out-base.js +30 -0
- package/src/components/iconography/jump-out-denominator.js +41 -0
- package/src/components/iconography/jump-out-exponent.js +30 -0
- package/src/components/iconography/jump-out-numerator.js +41 -0
- package/src/components/iconography/jump-out-parentheses.js +33 -0
- package/src/components/iconography/left-paren.js +33 -0
- package/src/components/iconography/left.js +16 -0
- package/src/components/iconography/leq.js +33 -0
- package/src/components/iconography/ln.js +29 -0
- package/src/components/iconography/log-n.js +29 -0
- package/src/components/iconography/log.js +29 -0
- package/src/components/iconography/lt.js +33 -0
- package/src/components/iconography/minus.js +32 -0
- package/src/components/iconography/neq.js +33 -0
- package/src/components/iconography/parens.js +33 -0
- package/src/components/iconography/percent.js +49 -0
- package/src/components/iconography/period.js +26 -0
- package/src/components/iconography/plus.js +32 -0
- package/src/components/iconography/radical.js +36 -0
- package/src/components/iconography/right-paren.js +33 -0
- package/src/components/iconography/right.js +16 -0
- package/src/components/iconography/sin.js +30 -0
- package/src/components/iconography/sqrt.js +32 -0
- package/src/components/iconography/tan.js +30 -0
- package/src/components/iconography/times.js +33 -0
- package/src/components/iconography/up.js +16 -0
- package/src/components/input/__tests__/context-tracking_test.js +177 -0
- package/src/components/input/__tests__/mathquill_test.js +747 -0
- package/src/components/input/__tests__/test-math-wrapper.jsx +33 -0
- package/src/components/input/cursor-contexts.ts +44 -0
- package/src/components/input/cursor-handle.tsx +137 -0
- package/src/components/input/drag-listener.js +75 -0
- package/src/components/input/math-input.tsx +993 -0
- package/src/components/input/math-wrapper.js +959 -0
- package/src/components/input/scroll-into-view.js +72 -0
- package/src/components/keypad/button-assets.tsx +493 -0
- package/src/components/keypad/button.stories.js +29 -0
- package/src/components/keypad/button.tsx +104 -0
- package/src/components/keypad/index.tsx +65 -0
- package/src/components/keypad/keypad-page-items.tsx +89 -0
- package/src/components/keypad/keypad-pages.stories.tsx +30 -0
- package/src/components/keypad/keypad.stories.tsx +33 -0
- package/src/components/keypad/numeric-input-page.tsx +99 -0
- package/src/components/keypad/pre-algebra-page.tsx +97 -0
- package/src/components/keypad/trigonometry-page.tsx +89 -0
- package/src/components/keypad-button.js +362 -0
- package/src/components/keypad-container.js +299 -0
- package/src/components/keypad.js +154 -0
- package/src/components/many-keypad-button.js +44 -0
- package/src/components/math-icon.js +65 -0
- package/src/components/multi-symbol-grid.js +182 -0
- package/src/components/multi-symbol-popover.js +59 -0
- package/src/components/navigation-pad.js +139 -0
- package/src/components/node-manager.js +129 -0
- package/src/components/popover-manager.js +76 -0
- package/src/components/popover-state-machine.js +173 -0
- package/src/components/prop-types.js +82 -0
- package/src/components/provided-keypad.tsx +105 -0
- package/src/components/styles.js +38 -0
- package/src/components/svg-icon.js +25 -0
- package/src/components/tabbar/__tests__/tabbar_test.js +65 -0
- package/src/components/tabbar/icons.tsx +64 -0
- package/src/components/tabbar/item.tsx +136 -0
- package/src/components/tabbar/tabbar.stories.js +60 -0
- package/src/components/tabbar/tabbar.tsx +59 -0
- package/src/components/tabbar/types.ts +1 -0
- package/src/components/text-icon.js +52 -0
- package/src/components/touchable-keypad-button.js +146 -0
- package/src/components/two-page-keypad.js +99 -0
- package/src/components/velocity-tracker.js +76 -0
- package/src/components/z-indexes.ts +8 -0
- package/src/consts.ts +91 -0
- package/src/data/key-configs.ts +349 -0
- package/src/data/keys.ts +124 -0
- package/src/demo.js +9 -0
- package/src/fake-react-native-web/index.ts +11 -0
- package/src/fake-react-native-web/text.tsx +54 -0
- package/src/fake-react-native-web/view.tsx +88 -0
- package/src/index.ts +22 -0
- package/src/native-app.js +85 -0
- package/src/store/index.ts +534 -0
- package/src/utils.ts +14 -0
- package/tools/svg-to-react/convert.py +111 -0
- package/tools/svg-to-react/icons/math-keypad-icon-0.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-1.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-2.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-3.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-4.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-5.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-6.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-7.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-8.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-9.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-addition.svg +34 -0
- package/tools/svg-to-react/icons/math-keypad-icon-cos.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-delete.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-dismiss.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-division.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-equals-not.svg +50 -0
- package/tools/svg-to-react/icons/math-keypad-icon-equals.svg +48 -0
- package/tools/svg-to-react/icons/math-keypad-icon-exponent-2.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-exponent-3.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-exponent.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-fraction.svg +42 -0
- package/tools/svg-to-react/icons/math-keypad-icon-greater-than.svg +46 -0
- package/tools/svg-to-react/icons/math-keypad-icon-jump-out-base.svg +44 -0
- package/tools/svg-to-react/icons/math-keypad-icon-jump-out-denominator.svg +48 -0
- package/tools/svg-to-react/icons/math-keypad-icon-jump-out-exponent.svg +44 -0
- package/tools/svg-to-react/icons/math-keypad-icon-jump-out-parentheses.svg +44 -0
- package/tools/svg-to-react/icons/math-keypad-icon-less-than.svg +46 -0
- package/tools/svg-to-react/icons/math-keypad-icon-log-10.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-log-e.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-log.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-multiplication-cross.svg +40 -0
- package/tools/svg-to-react/icons/math-keypad-icon-multiplication-dot.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-percent.svg +42 -0
- package/tools/svg-to-react/icons/math-keypad-icon-radical-2.svg +36 -0
- package/tools/svg-to-react/icons/math-keypad-icon-radical-3.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-radical.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-radix-character.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-sin.svg +38 -0
- package/tools/svg-to-react/icons/math-keypad-icon-subtraction.svg +32 -0
- package/tools/svg-to-react/icons/math-keypad-icon-tan.svg +38 -0
- package/tools/svg-to-react/symbol_map.py +41 -0
- package/tsconfig.json +9 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {StyleSheet, css} from "aphrodite";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import type {CSSProperties} from "aphrodite";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
// The `dynamicStyle` prop is provided for animating dynamic
|
|
9
|
+
// properties, as creating Aphrodite StyleSheets in animation loops is
|
|
10
|
+
// expensive. `dynamicStyle` should be a raw style object, rather than
|
|
11
|
+
// a StyleSheet.
|
|
12
|
+
dynamicStyle?: CSSProperties;
|
|
13
|
+
numberOfLines?: number;
|
|
14
|
+
style?: CSSProperties;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
class Text extends React.Component<Props> {
|
|
18
|
+
render(): React.ReactNode {
|
|
19
|
+
const {numberOfLines, style} = this.props;
|
|
20
|
+
|
|
21
|
+
const className = css(
|
|
22
|
+
styles.initial,
|
|
23
|
+
...(Array.isArray(style) ? style : [style]),
|
|
24
|
+
numberOfLines === 1 && styles.singleLineStyle,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<span className={className} style={this.props.dynamicStyle}>
|
|
29
|
+
{this.props.children}
|
|
30
|
+
</span>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// https://github.com/necolas/react-native-web/blob/master/src/components/Text/index.js
|
|
36
|
+
const styles = StyleSheet.create({
|
|
37
|
+
initial: {
|
|
38
|
+
color: "inherit",
|
|
39
|
+
display: "inline",
|
|
40
|
+
font: "inherit",
|
|
41
|
+
margin: 0,
|
|
42
|
+
padding: 0,
|
|
43
|
+
textDecorationLine: "none",
|
|
44
|
+
wordWrap: "break-word",
|
|
45
|
+
},
|
|
46
|
+
singleLineStyle: {
|
|
47
|
+
maxWidth: "100%",
|
|
48
|
+
overflow: "hidden",
|
|
49
|
+
textOverflow: "ellipsis",
|
|
50
|
+
whiteSpace: "nowrap",
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export default Text;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {StyleSheet, css} from "aphrodite";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
import type {CSSProperties} from "aphrodite";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
// The `dynamicStyle` prop is provided for animating dynamic
|
|
10
|
+
// properties, as creating Aphrodite StyleSheets in animation loops is
|
|
11
|
+
// expensive. `dynamicStyle` should be a raw style object, rather than
|
|
12
|
+
// a StyleSheet.
|
|
13
|
+
dynamicStyle?: CSSProperties;
|
|
14
|
+
// The `extraClassName` prop should almost never be used. It gives the
|
|
15
|
+
// client a way to provide an additional CSS class name, to augment
|
|
16
|
+
// the class name generated by Aphrodite. (Right now, it's only used to
|
|
17
|
+
// disable some externally-applied CSS that would otherwise be far too
|
|
18
|
+
// difficult to override with inline styles.)
|
|
19
|
+
extraClassName?: string;
|
|
20
|
+
numberOfLines?: number;
|
|
21
|
+
onClick?: (arg1: React.SyntheticEvent<HTMLDivElement>) => void;
|
|
22
|
+
onTouchCancel?: (arg1: React.TouchEvent<HTMLDivElement>) => void;
|
|
23
|
+
onTouchEnd?: (arg1: React.TouchEvent<HTMLDivElement>) => void;
|
|
24
|
+
onTouchMove?: (arg1: React.TouchEvent<HTMLDivElement>) => void;
|
|
25
|
+
onTouchStart?: (arg1: React.TouchEvent<HTMLDivElement>) => void;
|
|
26
|
+
role?: string;
|
|
27
|
+
style?: CSSProperties;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
class View extends React.Component<Props> {
|
|
31
|
+
static styles = StyleSheet.create({
|
|
32
|
+
// From: https://github.com/necolas/react-native-web/blob/master/src/components/View/index.js
|
|
33
|
+
// eslint-disable-next-line react-native/no-unused-styles
|
|
34
|
+
initial: {
|
|
35
|
+
alignItems: "stretch",
|
|
36
|
+
borderWidth: 0,
|
|
37
|
+
borderStyle: "solid",
|
|
38
|
+
boxSizing: "border-box",
|
|
39
|
+
display: "flex",
|
|
40
|
+
flexBasis: "auto",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
margin: 0,
|
|
43
|
+
padding: 0,
|
|
44
|
+
position: "relative",
|
|
45
|
+
// button and anchor reset
|
|
46
|
+
backgroundColor: "transparent",
|
|
47
|
+
color: "inherit",
|
|
48
|
+
font: "inherit",
|
|
49
|
+
textAlign: "inherit",
|
|
50
|
+
textDecorationLine: "none",
|
|
51
|
+
// list reset
|
|
52
|
+
listStyle: "none",
|
|
53
|
+
// fix flexbox bugs
|
|
54
|
+
maxWidth: "100%",
|
|
55
|
+
minHeight: 0,
|
|
56
|
+
minWidth: 0,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
render(): React.ReactNode {
|
|
61
|
+
const className =
|
|
62
|
+
css(
|
|
63
|
+
View.styles.initial,
|
|
64
|
+
...(Array.isArray(this.props.style)
|
|
65
|
+
? this.props.style
|
|
66
|
+
: [this.props.style]),
|
|
67
|
+
) +
|
|
68
|
+
(this.props.extraClassName ? ` ${this.props.extraClassName}` : "");
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<div
|
|
72
|
+
className={className}
|
|
73
|
+
style={this.props.dynamicStyle}
|
|
74
|
+
onClick={this.props.onClick}
|
|
75
|
+
onTouchCancel={this.props.onTouchCancel}
|
|
76
|
+
onTouchEnd={this.props.onTouchEnd}
|
|
77
|
+
onTouchMove={this.props.onTouchMove}
|
|
78
|
+
onTouchStart={this.props.onTouchStart}
|
|
79
|
+
aria-label={this.props.ariaLabel}
|
|
80
|
+
role={this.props.role}
|
|
81
|
+
>
|
|
82
|
+
{this.props.children}
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default View;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single entry-point for all of the external-facing functionality.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import "../less/main.less";
|
|
6
|
+
|
|
7
|
+
export {default as KeypadInput} from "./components/input/math-input";
|
|
8
|
+
export {
|
|
9
|
+
keypadConfigurationPropType,
|
|
10
|
+
keypadElementPropType,
|
|
11
|
+
} from "./components/prop-types";
|
|
12
|
+
export {default as Keypad} from "./components/provided-keypad";
|
|
13
|
+
export {KeypadTypes} from "./consts";
|
|
14
|
+
export {default as KeyConfigs} from "./data/key-configs";
|
|
15
|
+
|
|
16
|
+
import * as CursorContexts from "./components/input/cursor-contexts";
|
|
17
|
+
|
|
18
|
+
export {CursorContexts};
|
|
19
|
+
|
|
20
|
+
export type {KeypadType, KeyType} from "./consts";
|
|
21
|
+
export type {Key} from "./data/keys";
|
|
22
|
+
export type {CursorContext} from "./components/input/cursor-contexts";
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
3
|
+
|
|
4
|
+
import KeyConfigs from "./data/key-configs";
|
|
5
|
+
import {View} from "./fake-react-native-web/index";
|
|
6
|
+
|
|
7
|
+
import {KeypadInput} from "./index";
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line react/prop-types
|
|
10
|
+
const ManualInput = ({handler}) => {
|
|
11
|
+
return (
|
|
12
|
+
<div>
|
|
13
|
+
{Object.keys(KeyConfigs).map((k) => (
|
|
14
|
+
<button
|
|
15
|
+
style={{display: "block"}}
|
|
16
|
+
disabled={!handler}
|
|
17
|
+
onClick={() => handler(k)}
|
|
18
|
+
>
|
|
19
|
+
{k} : {KeyConfigs[k].ariaLabel}
|
|
20
|
+
</button>
|
|
21
|
+
))}
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
class App extends React.Component {
|
|
27
|
+
state = {
|
|
28
|
+
active: false,
|
|
29
|
+
handler: null,
|
|
30
|
+
keypadElement: {
|
|
31
|
+
activate: () => this.setState({active: true}),
|
|
32
|
+
dismiss: () => this.setState({active: false}),
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
configure: (config) => console.log("configure:", config),
|
|
35
|
+
// eslint-disable-next-line no-console
|
|
36
|
+
setCursor: (cursor) => console.log("Cursor:", cursor),
|
|
37
|
+
setKeyHandler: (handler) => this.setState({handler}),
|
|
38
|
+
getDOMNode: () => null,
|
|
39
|
+
},
|
|
40
|
+
value: "",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
render() {
|
|
44
|
+
return (
|
|
45
|
+
<View>
|
|
46
|
+
<div
|
|
47
|
+
style={{
|
|
48
|
+
marginTop: 10,
|
|
49
|
+
marginLeft: 20,
|
|
50
|
+
marginRight: 20,
|
|
51
|
+
marginBottom: 40,
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<KeypadInput
|
|
55
|
+
value={this.state.value}
|
|
56
|
+
ref={(inp) => (this.inp = inp)}
|
|
57
|
+
keypadElement={this.state.keypadElement}
|
|
58
|
+
onChange={(value, cb) => this.setState({value}, cb)}
|
|
59
|
+
onFocus={() => this.state.keypadElement.activate()}
|
|
60
|
+
onBlur={() => this.state.keypadElement.dismiss()}
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
<div>
|
|
64
|
+
<button
|
|
65
|
+
style={{display: "block"}}
|
|
66
|
+
onClick={() => this.inp.focus()}
|
|
67
|
+
>
|
|
68
|
+
Focus
|
|
69
|
+
</button>
|
|
70
|
+
</div>
|
|
71
|
+
<div style={{padding: 20}}>
|
|
72
|
+
Handler assigned: {"" + !!this.state.handler}
|
|
73
|
+
<br />
|
|
74
|
+
Active: {"" + this.state.active}
|
|
75
|
+
</div>
|
|
76
|
+
<br />
|
|
77
|
+
<br />
|
|
78
|
+
<ManualInput handler={this.state.handler} />
|
|
79
|
+
</View>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
85
|
+
ReactDOM.render(<App />, document.getElementById("root"));
|