@momo-kits/calculator-keyboard 0.167.1-beta.5 → 0.167.1-beta.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/package.json +3 -2
- package/shared/react/renderer/components/InputCalculatorSpec/ComponentDescriptors.cpp +7 -0
- package/shared/react/renderer/components/InputCalculatorSpec/ComponentDescriptors.h +14 -0
- package/shared/react/renderer/components/InputCalculatorSpec/InputCalculatorComponentDescriptor.h +29 -0
- package/shared/react/renderer/components/InputCalculatorSpec/InputCalculatorShadowNode.cpp +7 -0
- package/shared/react/renderer/components/InputCalculatorSpec/InputCalculatorShadowNode.h +26 -0
- package/shared/react/renderer/components/InputCalculatorSpec/InputCalculatorState.cpp +13 -0
- package/shared/react/renderer/components/InputCalculatorSpec/InputCalculatorState.h +34 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/calculator-keyboard",
|
|
3
|
-
"version": "0.167.1-beta.
|
|
3
|
+
"version": "0.167.1-beta.6",
|
|
4
4
|
"description": "react native calculator keyboard",
|
|
5
5
|
"main": "./src/index.tsx",
|
|
6
6
|
"files": [
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"android",
|
|
10
10
|
"ios",
|
|
11
11
|
"cpp",
|
|
12
|
+
"shared",
|
|
12
13
|
"*.podspec",
|
|
13
14
|
"react-native.config.js",
|
|
14
15
|
"!ios/build",
|
|
@@ -72,4 +73,4 @@
|
|
|
72
73
|
"node": ">=18.0.0"
|
|
73
74
|
},
|
|
74
75
|
"dependencies": {}
|
|
75
|
-
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#include <react/renderer/components/InputCalculatorSpec/ComponentDescriptors.h>
|
|
2
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
3
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
4
|
+
|
|
5
|
+
namespace facebook::react {
|
|
6
|
+
|
|
7
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/components/InputCalculatorSpec/ShadowNodes.h>
|
|
4
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
5
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
6
|
+
|
|
7
|
+
#include <react/renderer/components/InputCalculatorSpec/InputCalculatorComponentDescriptor.h>
|
|
8
|
+
|
|
9
|
+
namespace facebook::react {
|
|
10
|
+
|
|
11
|
+
void InputCalculatorSpec_registerComponentDescriptorsFromCodegen(
|
|
12
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
13
|
+
|
|
14
|
+
} // namespace facebook::react
|
package/shared/react/renderer/components/InputCalculatorSpec/InputCalculatorComponentDescriptor.h
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/debug/react_native_assert.h>
|
|
4
|
+
#include <react/renderer/components/InputCalculatorSpec/Props.h>
|
|
5
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
6
|
+
#include <react/renderer/components/InputCalculatorSpec/InputCalculatorShadowNode.h>
|
|
7
|
+
|
|
8
|
+
namespace facebook {
|
|
9
|
+
namespace react {
|
|
10
|
+
|
|
11
|
+
class InputCalculatorComponentDescriptor final
|
|
12
|
+
: public ConcreteComponentDescriptor<InputCalculatorShadowNode> {
|
|
13
|
+
public:
|
|
14
|
+
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
|
|
15
|
+
|
|
16
|
+
void adopt(ShadowNode &shadowNode) const override {
|
|
17
|
+
react_native_assert(dynamic_cast<InputCalculatorShadowNode *>(&shadowNode));
|
|
18
|
+
|
|
19
|
+
const auto inputCalculatorShadowNode = dynamic_cast<InputCalculatorShadowNode *>(&shadowNode);
|
|
20
|
+
const auto state = inputCalculatorShadowNode->getStateData();
|
|
21
|
+
|
|
22
|
+
inputCalculatorShadowNode->setSize({state.getWidth(), state.getHeight()});
|
|
23
|
+
|
|
24
|
+
ConcreteComponentDescriptor::adopt(shadowNode);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
} // namespace react
|
|
29
|
+
} // namespace facebook
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/components/InputCalculatorSpec/EventEmitters.h>
|
|
4
|
+
#include <react/renderer/components/InputCalculatorSpec/Props.h>
|
|
5
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
6
|
+
#include <react/renderer/components/InputCalculatorSpec/InputCalculatorState.h>
|
|
7
|
+
#include <jsi/jsi.h>
|
|
8
|
+
|
|
9
|
+
namespace facebook::react {
|
|
10
|
+
|
|
11
|
+
JSI_EXPORT extern const char InputCalculatorComponentName[];
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* `ShadowNode` for <InputCalculator> component.
|
|
15
|
+
*/
|
|
16
|
+
class InputCalculatorShadowNode final : public ConcreteViewShadowNode<
|
|
17
|
+
InputCalculatorComponentName,
|
|
18
|
+
InputCalculatorProps,
|
|
19
|
+
InputCalculatorEventEmitter,
|
|
20
|
+
InputCalculatorState> {
|
|
21
|
+
public:
|
|
22
|
+
|
|
23
|
+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#include <react/renderer/components/InputCalculatorSpec/InputCalculatorState.h>
|
|
2
|
+
|
|
3
|
+
namespace facebook::react {
|
|
4
|
+
|
|
5
|
+
float InputCalculatorState::getWidth() const {
|
|
6
|
+
return width_;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
float InputCalculatorState::getHeight() const {
|
|
10
|
+
return height_;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#ifdef ANDROID
|
|
4
|
+
#include <folly/dynamic.h>
|
|
5
|
+
#endif
|
|
6
|
+
|
|
7
|
+
namespace facebook::react {
|
|
8
|
+
|
|
9
|
+
class InputCalculatorState {
|
|
10
|
+
public:
|
|
11
|
+
InputCalculatorState()
|
|
12
|
+
: width_(0), height_(0) {}
|
|
13
|
+
|
|
14
|
+
InputCalculatorState(float width, float height)
|
|
15
|
+
: width_(width), height_(height) {}
|
|
16
|
+
|
|
17
|
+
#ifdef ANDROID
|
|
18
|
+
InputCalculatorState(InputCalculatorState const &previousState, folly::dynamic data)
|
|
19
|
+
: width_((float)data["width"].getDouble()),
|
|
20
|
+
height_((float)data["height"].getDouble()){};
|
|
21
|
+
folly::dynamic getDynamic() const {
|
|
22
|
+
return {};
|
|
23
|
+
};
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
float getWidth() const;
|
|
27
|
+
float getHeight() const;
|
|
28
|
+
|
|
29
|
+
private:
|
|
30
|
+
const float width_{};
|
|
31
|
+
const float height_{};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
} // namespace facebook::react
|