@solidx/checkbox 0.0.0-stage → 0.7.0
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/RNCCheckbox.podspec +22 -0
- package/android/build.gradle +54 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/android/gradle.properties +4 -0
- package/android/gradlew +172 -0
- package/android/gradlew.bat +84 -0
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/java/com/reactnativecommunity/checkbox/ReactCheckBox.java +43 -0
- package/android/src/main/java/com/reactnativecommunity/checkbox/ReactCheckBoxEvent.java +52 -0
- package/android/src/main/java/com/reactnativecommunity/checkbox/ReactCheckBoxManager.java +134 -0
- package/android/src/main/java/com/reactnativecommunity/checkbox/ReactCheckBoxPackage.java +29 -0
- package/dist/AndroidCheckBoxNativeComponent.d.ts +2 -0
- package/dist/AndroidCheckBoxNativeComponent.js +11 -0
- package/dist/CheckBox.android.d.ts +83 -0
- package/dist/CheckBox.android.js +160 -0
- package/dist/CheckBox.d.ts +1 -0
- package/dist/CheckBox.ios.d.ts +92 -0
- package/dist/CheckBox.ios.js +103 -0
- package/dist/CheckBox.js +2 -0
- package/dist/CheckBox.windows.d.ts +77 -0
- package/dist/CheckBox.windows.js +96 -0
- package/dist/IOSCheckBoxNativeComponent.d.ts +2 -0
- package/dist/IOSCheckBoxNativeComponent.js +11 -0
- package/dist/WindowsCheckBoxComponent.d.ts +2 -0
- package/dist/WindowsCheckBoxComponent.js +6 -0
- package/dist/setAndForwardRef.d.ts +40 -0
- package/dist/setAndForwardRef.js +52 -0
- package/ios/Podfile +3 -0
- package/ios/Podfile.lock +16 -0
- package/ios/RNCCheckbox.h +16 -0
- package/ios/RNCCheckbox.m +13 -0
- package/ios/RNCCheckbox.xcodeproj/project.pbxproj +322 -0
- package/ios/RNCCheckbox.xcodeproj/xcshareddata/xcschemes/RNCCheckbox.xcscheme +67 -0
- package/ios/RNCCheckbox.xcworkspace/contents.xcworkspacedata +10 -0
- package/ios/RNCCheckbox.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/RNCCheckbox.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +10 -0
- package/ios/RNCCheckboxManager.h +12 -0
- package/ios/RNCCheckboxManager.m +86 -0
- package/package.json +76 -4
- package/typings/index.d.ts +14 -0
- package/windows/CheckboxWindows/CheckboxView.cpp +116 -0
- package/windows/CheckboxWindows/CheckboxView.h +33 -0
- package/windows/CheckboxWindows/CheckboxView.idl +11 -0
- package/windows/CheckboxWindows/CheckboxViewManager.cpp +73 -0
- package/windows/CheckboxWindows/CheckboxViewManager.h +44 -0
- package/windows/CheckboxWindows/CheckboxWindows.def +3 -0
- package/windows/CheckboxWindows/CheckboxWindows.rc +0 -0
- package/windows/CheckboxWindows/CheckboxWindows.vcxproj +189 -0
- package/windows/CheckboxWindows/CheckboxWindows.vcxproj.filters +43 -0
- package/windows/CheckboxWindows/PropertySheet.props +16 -0
- package/windows/CheckboxWindows/ReactPackageProvider.cpp +18 -0
- package/windows/CheckboxWindows/ReactPackageProvider.h +23 -0
- package/windows/CheckboxWindows/ReactPackageProvider.idl +9 -0
- package/windows/CheckboxWindows/packages.config +4 -0
- package/windows/CheckboxWindows/pch.cpp +1 -0
- package/windows/CheckboxWindows/pch.h +4 -0
- package/windows/CheckboxWindows/readme.txt +23 -0
- package/windows/CheckboxWindows/resource.h +14 -0
- package/windows/CheckboxWindows.sln +226 -0
- package/windows/CheckboxWindows62.sln +254 -0
- package/README.md +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidx/checkbox",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "React Native Checkbox native modules for Android , iOS and Windows",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"checkbox",
|
|
7
|
+
"react native",
|
|
8
|
+
"react-native"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/react-native-community/react-native-checkbox#readme",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/react-native-community/react-native-checkbox.git"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "Nicholas Lee <nicholaslee119@gmail.com>",
|
|
17
|
+
"main": "dist/CheckBox",
|
|
18
|
+
"types": "typings/index.d.ts",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@babel/core": "^7.8.3",
|
|
24
|
+
"@babel/plugin-proposal-class-properties": "^7.4.0",
|
|
25
|
+
"@react-native-community/eslint-config": "^1.1.0",
|
|
26
|
+
"@react-native-community/eslint-plugin": "^1.0.0",
|
|
27
|
+
"@types/jest": "^24.0.25",
|
|
28
|
+
"@types/react-native": "^0.62",
|
|
29
|
+
"@types/react-test-renderer": "16.9.0",
|
|
30
|
+
"babel-plugin-module-resolver": "^3.1.3",
|
|
31
|
+
"detox": "^16.4.1",
|
|
32
|
+
"eslint": "^6.8.0",
|
|
33
|
+
"eslint-plugin-prettier": "^3.1.2",
|
|
34
|
+
"jest": "^24.7.1",
|
|
35
|
+
"metro-react-native-babel-preset": "0.59.0",
|
|
36
|
+
"prettier": "^2.0.5",
|
|
37
|
+
"react": "16.11.0",
|
|
38
|
+
"react-native": "0.62",
|
|
39
|
+
"react-native-windows": "^0.62",
|
|
40
|
+
"react-test-renderer": "16.9.0",
|
|
41
|
+
"ts-jest": "^24.2.0",
|
|
42
|
+
"typescript": "^3.8.3",
|
|
43
|
+
"xcpretty": "^0.2.8001"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": "*",
|
|
47
|
+
"react-native": ">= 0.62",
|
|
48
|
+
"react-native-windows": ">=0.62"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"react-native-windows": {
|
|
52
|
+
"optional": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
},
|
|
58
|
+
"eslintConfig": {
|
|
59
|
+
"extends": "@react-native-community",
|
|
60
|
+
"env": {
|
|
61
|
+
"es6": true,
|
|
62
|
+
"jest": true
|
|
63
|
+
},
|
|
64
|
+
"globals": {
|
|
65
|
+
"it": true,
|
|
66
|
+
"expect": true,
|
|
67
|
+
"element": true,
|
|
68
|
+
"describe": true,
|
|
69
|
+
"by": true,
|
|
70
|
+
"device": true,
|
|
71
|
+
"beforeAll": true,
|
|
72
|
+
"beforeEach": true,
|
|
73
|
+
"afterAll": true,
|
|
74
|
+
"jest": true,
|
|
75
|
+
"jasmine": true
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {Component} from 'react';
|
|
2
|
+
import {NativeMethods} from 'react-native';
|
|
3
|
+
import {Props as AndroidProps} from '../dist/CheckBox.android';
|
|
4
|
+
import {Props as IOSProps} from '../dist/CheckBox.ios';
|
|
5
|
+
import {Props as WindowsProps} from '../dist/CheckBox.windows';
|
|
6
|
+
|
|
7
|
+
type Constructor<T> = new (...args: any[]) => T;
|
|
8
|
+
|
|
9
|
+
type CheckBoxProps = AndroidProps & IOSProps & WindowsProps;
|
|
10
|
+
|
|
11
|
+
declare class CheckBoxComponent extends Component<CheckBoxProps> {}
|
|
12
|
+
declare const CheckBoxBase: Constructor<NativeMethods> &
|
|
13
|
+
typeof CheckBoxComponent;
|
|
14
|
+
export default class CheckBox extends CheckBoxBase {}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
|
|
6
|
+
#include "JSValueXaml.h"
|
|
7
|
+
|
|
8
|
+
#include "CheckboxView.h"
|
|
9
|
+
#include "CheckboxView.g.cpp"
|
|
10
|
+
|
|
11
|
+
#include "winrt/Windows.UI.Xaml.Media.h"
|
|
12
|
+
#include "winrt/Windows.UI.Xaml.Media.Imaging.h"
|
|
13
|
+
#include "winrt/Windows.UI.Xaml.Input.h"
|
|
14
|
+
|
|
15
|
+
namespace winrt {
|
|
16
|
+
using namespace Microsoft::ReactNative;
|
|
17
|
+
using namespace Windows::Foundation;
|
|
18
|
+
using namespace Windows::UI;
|
|
19
|
+
using namespace Windows::UI::Xaml::Media;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
namespace winrt::CheckboxWindows::implementation {
|
|
23
|
+
|
|
24
|
+
CheckboxView::CheckboxView(winrt::IReactContext const& reactContext) : m_reactContext(reactContext) {
|
|
25
|
+
RegisterEvents();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void CheckboxView::RegisterEvents() {
|
|
29
|
+
|
|
30
|
+
m_checkBoxCheckedRevoker = this->Checked(winrt::auto_revoke,
|
|
31
|
+
[ref = get_weak()](auto const& sender, auto const& args) {
|
|
32
|
+
if (auto self = ref.get()) {
|
|
33
|
+
self->OnCheckedHandler(sender, args, true);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
m_checkBoxUncheckedRevoker = this->Unchecked(winrt::auto_revoke,
|
|
38
|
+
[ref = get_weak()](auto const& sender, auto const& args) {
|
|
39
|
+
if (auto self = ref.get()) {
|
|
40
|
+
self->OnCheckedHandler(sender, args, false);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
void CheckboxView::UpdateProperties(winrt::IJSValueReader const& reader) {
|
|
46
|
+
m_updating = true;
|
|
47
|
+
auto const& propertyMap = JSValueObject::ReadFrom(reader);
|
|
48
|
+
|
|
49
|
+
for (auto const& pair : propertyMap) {
|
|
50
|
+
auto const& propertyName = pair.first;
|
|
51
|
+
auto const& propertyValue = pair.second;
|
|
52
|
+
|
|
53
|
+
if (propertyName == "value") {
|
|
54
|
+
if (propertyValue.IsNull()) {
|
|
55
|
+
this->ClearValue(xaml::Controls::Primitives::ToggleButton::IsCheckedProperty());
|
|
56
|
+
} else {
|
|
57
|
+
this->IsChecked(propertyValue.AsBoolean());
|
|
58
|
+
}
|
|
59
|
+
} else if (propertyName == "onCheckColor") {
|
|
60
|
+
if (!propertyValue.IsNull()) {
|
|
61
|
+
auto resDict = this->Resources();
|
|
62
|
+
|
|
63
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckGlyphForegroundChecked"), propertyValue.To<winrt::Brush>());
|
|
64
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckGlyphForegroundCheckedPointerOver"), propertyValue.To<winrt::Brush>());
|
|
65
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckGlyphForegroundCheckedPressed"), propertyValue.To<winrt::Brush>());
|
|
66
|
+
}
|
|
67
|
+
} else if (propertyName == "onTintColor") {
|
|
68
|
+
if (!propertyValue.IsNull()) {
|
|
69
|
+
auto resDict = this->Resources();
|
|
70
|
+
|
|
71
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundStrokeChecked"), propertyValue.To<winrt::Brush>());
|
|
72
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundStrokeCheckedPointerOver"), propertyValue.To<winrt::Brush>());
|
|
73
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundStrokeCheckedPressed"), propertyValue.To<winrt::Brush>());
|
|
74
|
+
}
|
|
75
|
+
} else if (propertyName == "onFillColor") {
|
|
76
|
+
if (!propertyValue.IsNull()) {
|
|
77
|
+
auto resDict = this->Resources();
|
|
78
|
+
|
|
79
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillChecked"), propertyValue.To<winrt::Brush>());
|
|
80
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillCheckedPointerOver"), propertyValue.To<winrt::Brush>());
|
|
81
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillCheckedPressed"), propertyValue.To<winrt::Brush>());
|
|
82
|
+
}
|
|
83
|
+
} else if (propertyName == "tintColor") {
|
|
84
|
+
if (!propertyValue.IsNull()) {
|
|
85
|
+
auto resDict = this->Resources();
|
|
86
|
+
|
|
87
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillUnchecked"), propertyValue.To<winrt::Brush>());
|
|
88
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillUncheckedPointerOver"), propertyValue.To<winrt::Brush>());
|
|
89
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillUncheckedPressed"), propertyValue.To<winrt::Brush>());
|
|
90
|
+
}
|
|
91
|
+
} else if (propertyName == "disabled") {
|
|
92
|
+
if (!propertyValue.IsNull()) {
|
|
93
|
+
this->IsEnabled(!propertyValue.AsBoolean());
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
m_updating = false;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
void CheckboxView::OnCheckedHandler(winrt::Windows::Foundation::IInspectable const& /*sender*/, xaml::RoutedEventArgs const& args, bool isChecked) {
|
|
103
|
+
if (!m_updating) {
|
|
104
|
+
m_reactContext.DispatchEvent(
|
|
105
|
+
*this,
|
|
106
|
+
L"topChange",
|
|
107
|
+
[&](winrt::Microsoft::ReactNative::IJSValueWriter const& eventDataWriter) noexcept {
|
|
108
|
+
eventDataWriter.WriteObjectBegin();
|
|
109
|
+
{
|
|
110
|
+
WriteProperty(eventDataWriter, L"value", isChecked);
|
|
111
|
+
}
|
|
112
|
+
eventDataWriter.WriteObjectEnd();
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include "CheckboxView.g.h"
|
|
7
|
+
#include "winrt/Microsoft.ReactNative.h"
|
|
8
|
+
#include "NativeModules.h"
|
|
9
|
+
|
|
10
|
+
namespace winrt::CheckboxWindows::implementation {
|
|
11
|
+
|
|
12
|
+
namespace xaml = winrt::Windows::UI::Xaml;
|
|
13
|
+
|
|
14
|
+
class CheckboxView : public CheckboxViewT<CheckboxView> {
|
|
15
|
+
public:
|
|
16
|
+
CheckboxView(Microsoft::ReactNative::IReactContext const& reactContext);
|
|
17
|
+
void UpdateProperties(Microsoft::ReactNative::IJSValueReader const& reader);
|
|
18
|
+
|
|
19
|
+
private:
|
|
20
|
+
Microsoft::ReactNative::IReactContext m_reactContext{ nullptr };
|
|
21
|
+
bool m_updating{ false };
|
|
22
|
+
|
|
23
|
+
xaml::Controls::CheckBox::Checked_revoker m_checkBoxCheckedRevoker{};
|
|
24
|
+
xaml::Controls::CheckBox::Unchecked_revoker m_checkBoxUncheckedRevoker{};
|
|
25
|
+
|
|
26
|
+
void RegisterEvents();
|
|
27
|
+
void OnCheckedHandler(winrt::Windows::Foundation::IInspectable const& /*sender*/, xaml::RoutedEventArgs const& args, bool isChecked);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
namespace winrt::CheckboxWindows::factory_implementation {
|
|
32
|
+
struct CheckboxView : CheckboxViewT<CheckboxView, implementation::CheckboxView> {};
|
|
33
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
namespace CheckboxWindows {
|
|
5
|
+
|
|
6
|
+
[default_interface]
|
|
7
|
+
runtimeclass CheckboxView : Windows.UI.Xaml.Controls.CheckBox {
|
|
8
|
+
CheckboxView(Microsoft.ReactNative.IReactContext context);
|
|
9
|
+
void UpdateProperties(Microsoft.ReactNative.IJSValueReader reader);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
#include "CheckboxViewManager.h"
|
|
6
|
+
#include "NativeModules.h"
|
|
7
|
+
#include "CheckboxView.h"
|
|
8
|
+
|
|
9
|
+
namespace winrt {
|
|
10
|
+
using namespace Microsoft::ReactNative;
|
|
11
|
+
using namespace Windows::Foundation::Collections;
|
|
12
|
+
|
|
13
|
+
namespace xaml = winrt::Windows::UI::Xaml;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
namespace winrt::CheckboxWindows::implementation {
|
|
17
|
+
|
|
18
|
+
CheckboxViewManager::CheckboxViewManager() {}
|
|
19
|
+
|
|
20
|
+
// IViewManager
|
|
21
|
+
winrt::hstring CheckboxViewManager::Name() noexcept {
|
|
22
|
+
return L"RNCCheckboxWindows";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
xaml::FrameworkElement CheckboxViewManager::CreateView() noexcept {
|
|
26
|
+
return winrt::CheckboxWindows::CheckboxView(m_reactContext);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// IViewManagerWithReactContext
|
|
30
|
+
winrt::IReactContext CheckboxViewManager::ReactContext() noexcept {
|
|
31
|
+
return m_reactContext;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void CheckboxViewManager::ReactContext(IReactContext reactContext) noexcept {
|
|
35
|
+
m_reactContext = reactContext;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// IViewManagerWithNativeProperties
|
|
39
|
+
IMapView<hstring, ViewManagerPropertyType> CheckboxViewManager::NativeProps() noexcept {
|
|
40
|
+
auto nativeProps = winrt::single_threaded_map<hstring, ViewManagerPropertyType>();
|
|
41
|
+
|
|
42
|
+
nativeProps.Insert(L"disabled", ViewManagerPropertyType::Boolean);
|
|
43
|
+
nativeProps.Insert(L"value", ViewManagerPropertyType::Boolean);
|
|
44
|
+
|
|
45
|
+
nativeProps.Insert(L"onCheckColor", ViewManagerPropertyType::Color);
|
|
46
|
+
nativeProps.Insert(L"onTintColor", ViewManagerPropertyType::Color);
|
|
47
|
+
nativeProps.Insert(L"onFillColor", ViewManagerPropertyType::Color);
|
|
48
|
+
nativeProps.Insert(L"tintColor", ViewManagerPropertyType::Color);
|
|
49
|
+
|
|
50
|
+
return nativeProps.GetView();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
void CheckboxViewManager::UpdateProperties(xaml::FrameworkElement const& view,
|
|
54
|
+
IJSValueReader const& propertyMapReader) noexcept {
|
|
55
|
+
if (auto checkboxView = view.try_as<CheckboxView>()) {
|
|
56
|
+
checkboxView->UpdateProperties(propertyMapReader);
|
|
57
|
+
} else {
|
|
58
|
+
OutputDebugStringW(L"Type deduction for CheckboxView failed.");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// IViewManagerWithExportedEventTypeConstants
|
|
63
|
+
ConstantProviderDelegate CheckboxViewManager::ExportedCustomBubblingEventTypeConstants() noexcept {
|
|
64
|
+
return nullptr;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
ConstantProviderDelegate CheckboxViewManager::ExportedCustomDirectEventTypeConstants() noexcept {
|
|
68
|
+
return [](winrt::IJSValueWriter const& constantWriter) {
|
|
69
|
+
WriteCustomDirectEventTypeConstant(constantWriter, "onChange");
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include "winrt/Microsoft.ReactNative.h"
|
|
7
|
+
#include "NativeModules.h"
|
|
8
|
+
|
|
9
|
+
namespace winrt::CheckboxWindows::implementation {
|
|
10
|
+
|
|
11
|
+
class CheckboxViewManager : public winrt::implements<
|
|
12
|
+
CheckboxViewManager,
|
|
13
|
+
winrt::Microsoft::ReactNative::IViewManager,
|
|
14
|
+
winrt::Microsoft::ReactNative::IViewManagerWithReactContext,
|
|
15
|
+
winrt::Microsoft::ReactNative::IViewManagerWithNativeProperties,
|
|
16
|
+
winrt::Microsoft::ReactNative::IViewManagerWithExportedEventTypeConstants> {
|
|
17
|
+
public:
|
|
18
|
+
CheckboxViewManager();
|
|
19
|
+
|
|
20
|
+
// IViewManager
|
|
21
|
+
winrt::hstring Name() noexcept;
|
|
22
|
+
winrt::Windows::UI::Xaml::FrameworkElement CreateView() noexcept;
|
|
23
|
+
|
|
24
|
+
// IViewManagerWithReactContext
|
|
25
|
+
winrt::Microsoft::ReactNative::IReactContext ReactContext() noexcept;
|
|
26
|
+
void ReactContext(winrt::Microsoft::ReactNative::IReactContext reactContext) noexcept;
|
|
27
|
+
|
|
28
|
+
// IViewManagerWithNativeProperties
|
|
29
|
+
winrt::Windows::Foundation::Collections::
|
|
30
|
+
IMapView<winrt::hstring, winrt::Microsoft::ReactNative::ViewManagerPropertyType>
|
|
31
|
+
NativeProps() noexcept;
|
|
32
|
+
|
|
33
|
+
void UpdateProperties(
|
|
34
|
+
winrt::Windows::UI::Xaml::FrameworkElement const& view,
|
|
35
|
+
winrt::Microsoft::ReactNative::IJSValueReader const& propertyMapReader) noexcept;
|
|
36
|
+
|
|
37
|
+
// IViewManagerWithExportedEventTypeConstants
|
|
38
|
+
winrt::Microsoft::ReactNative::ConstantProviderDelegate ExportedCustomBubblingEventTypeConstants() noexcept;
|
|
39
|
+
winrt::Microsoft::ReactNative::ConstantProviderDelegate ExportedCustomDirectEventTypeConstants() noexcept;
|
|
40
|
+
|
|
41
|
+
private:
|
|
42
|
+
winrt::Microsoft::ReactNative::IReactContext m_reactContext{ nullptr };
|
|
43
|
+
};
|
|
44
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props')" />
|
|
4
|
+
<PropertyGroup Label="Globals">
|
|
5
|
+
<CppWinRTOptimized>true</CppWinRTOptimized>
|
|
6
|
+
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
|
|
7
|
+
<CppWinRTGenerateWindowsMetadata>true</CppWinRTGenerateWindowsMetadata>
|
|
8
|
+
<MinimalCoreWin>true</MinimalCoreWin>
|
|
9
|
+
<ProjectGuid>{eaf81beb-a159-4421-9b6d-e59c37828a57}</ProjectGuid>
|
|
10
|
+
<ProjectName>CheckboxWindows</ProjectName>
|
|
11
|
+
<RootNamespace>CheckboxWindows</RootNamespace>
|
|
12
|
+
<DefaultLanguage>en-US</DefaultLanguage>
|
|
13
|
+
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
|
|
14
|
+
<AppContainerApplication>true</AppContainerApplication>
|
|
15
|
+
<ApplicationType>Windows Store</ApplicationType>
|
|
16
|
+
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
|
17
|
+
<WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion>
|
|
18
|
+
<WindowsTargetPlatformMinVersion>10.0.17763.0</WindowsTargetPlatformMinVersion>
|
|
19
|
+
</PropertyGroup>
|
|
20
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
21
|
+
<PropertyGroup Label="ReactNativeWindowsProps">
|
|
22
|
+
<ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(SolutionDir), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
|
|
23
|
+
</PropertyGroup>
|
|
24
|
+
<ItemGroup Label="ProjectConfigurations">
|
|
25
|
+
<ProjectConfiguration Include="Debug|ARM">
|
|
26
|
+
<Configuration>Debug</Configuration>
|
|
27
|
+
<Platform>ARM</Platform>
|
|
28
|
+
</ProjectConfiguration>
|
|
29
|
+
<ProjectConfiguration Include="Debug|ARM64">
|
|
30
|
+
<Configuration>Debug</Configuration>
|
|
31
|
+
<Platform>ARM64</Platform>
|
|
32
|
+
</ProjectConfiguration>
|
|
33
|
+
<ProjectConfiguration Include="Debug|Win32">
|
|
34
|
+
<Configuration>Debug</Configuration>
|
|
35
|
+
<Platform>Win32</Platform>
|
|
36
|
+
</ProjectConfiguration>
|
|
37
|
+
<ProjectConfiguration Include="Debug|x64">
|
|
38
|
+
<Configuration>Debug</Configuration>
|
|
39
|
+
<Platform>x64</Platform>
|
|
40
|
+
</ProjectConfiguration>
|
|
41
|
+
<ProjectConfiguration Include="Release|ARM">
|
|
42
|
+
<Configuration>Release</Configuration>
|
|
43
|
+
<Platform>ARM</Platform>
|
|
44
|
+
</ProjectConfiguration>
|
|
45
|
+
<ProjectConfiguration Include="Release|ARM64">
|
|
46
|
+
<Configuration>Release</Configuration>
|
|
47
|
+
<Platform>ARM64</Platform>
|
|
48
|
+
</ProjectConfiguration>
|
|
49
|
+
<ProjectConfiguration Include="Release|Win32">
|
|
50
|
+
<Configuration>Release</Configuration>
|
|
51
|
+
<Platform>Win32</Platform>
|
|
52
|
+
</ProjectConfiguration>
|
|
53
|
+
<ProjectConfiguration Include="Release|x64">
|
|
54
|
+
<Configuration>Release</Configuration>
|
|
55
|
+
<Platform>x64</Platform>
|
|
56
|
+
</ProjectConfiguration>
|
|
57
|
+
</ItemGroup>
|
|
58
|
+
<PropertyGroup Label="Configuration">
|
|
59
|
+
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
60
|
+
<CharacterSet>Unicode</CharacterSet>
|
|
61
|
+
<GenerateManifest>false</GenerateManifest>
|
|
62
|
+
</PropertyGroup>
|
|
63
|
+
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
|
64
|
+
<UseDebugLibraries>true</UseDebugLibraries>
|
|
65
|
+
<LinkIncremental>true</LinkIncremental>
|
|
66
|
+
</PropertyGroup>
|
|
67
|
+
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
|
68
|
+
<UseDebugLibraries>false</UseDebugLibraries>
|
|
69
|
+
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
70
|
+
<LinkIncremental>false</LinkIncremental>
|
|
71
|
+
</PropertyGroup>
|
|
72
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
73
|
+
<ImportGroup Label="ExtensionSettings">
|
|
74
|
+
</ImportGroup>
|
|
75
|
+
<ImportGroup Label="PropertySheets">
|
|
76
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
77
|
+
</ImportGroup>
|
|
78
|
+
<ImportGroup Label="PropertySheets">
|
|
79
|
+
<Import Project="PropertySheet.props" />
|
|
80
|
+
</ImportGroup>
|
|
81
|
+
<ImportGroup Label="ReactNativeWindowsPropertySheets">
|
|
82
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" />
|
|
83
|
+
</ImportGroup>
|
|
84
|
+
<PropertyGroup Label="UserMacros" />
|
|
85
|
+
<PropertyGroup />
|
|
86
|
+
<ItemDefinitionGroup>
|
|
87
|
+
<ClCompile>
|
|
88
|
+
<PrecompiledHeader>Use</PrecompiledHeader>
|
|
89
|
+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
90
|
+
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
|
91
|
+
<WarningLevel>Level4</WarningLevel>
|
|
92
|
+
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
|
|
93
|
+
<!--Temporarily disable cppwinrt heap enforcement to work around xaml compiler generated std::shared_ptr use -->
|
|
94
|
+
<AdditionalOptions Condition="'$(CppWinRTHeapEnforcement)'==''">/DWINRT_NO_MAKE_DETECTION %(AdditionalOptions)</AdditionalOptions>
|
|
95
|
+
<DisableSpecificWarnings>
|
|
96
|
+
</DisableSpecificWarnings>
|
|
97
|
+
<PreprocessorDefinitions>_WINRT_DLL;WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
98
|
+
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
|
99
|
+
</ClCompile>
|
|
100
|
+
<Link>
|
|
101
|
+
<SubSystem>Console</SubSystem>
|
|
102
|
+
<GenerateWindowsMetadata>true</GenerateWindowsMetadata>
|
|
103
|
+
<ModuleDefinitionFile>CheckboxWindows.def</ModuleDefinitionFile>
|
|
104
|
+
</Link>
|
|
105
|
+
</ItemDefinitionGroup>
|
|
106
|
+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
|
107
|
+
<ClCompile>
|
|
108
|
+
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
109
|
+
</ClCompile>
|
|
110
|
+
</ItemDefinitionGroup>
|
|
111
|
+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
|
112
|
+
<ClCompile>
|
|
113
|
+
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
114
|
+
</ClCompile>
|
|
115
|
+
<Link>
|
|
116
|
+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
117
|
+
<OptimizeReferences>true</OptimizeReferences>
|
|
118
|
+
</Link>
|
|
119
|
+
</ItemDefinitionGroup>
|
|
120
|
+
<ItemGroup>
|
|
121
|
+
<ClInclude Include="pch.h" />
|
|
122
|
+
<ClInclude Include="CheckboxViewManager.h" />
|
|
123
|
+
<ClInclude Include="ReactPackageProvider.h">
|
|
124
|
+
<DependentUpon>ReactPackageProvider.idl</DependentUpon>
|
|
125
|
+
</ClInclude>
|
|
126
|
+
<ClInclude Include="CheckboxView.h">
|
|
127
|
+
<DependentUpon>CheckboxView.idl</DependentUpon>
|
|
128
|
+
</ClInclude>
|
|
129
|
+
<ClInclude Include="resource.h" />
|
|
130
|
+
</ItemGroup>
|
|
131
|
+
<ItemGroup>
|
|
132
|
+
<ClCompile Include="CheckboxViewManager.cpp" />
|
|
133
|
+
<ClCompile Include="pch.cpp">
|
|
134
|
+
<PrecompiledHeader>Create</PrecompiledHeader>
|
|
135
|
+
</ClCompile>
|
|
136
|
+
<ClCompile Include="CheckboxView.cpp">
|
|
137
|
+
<DependentUpon>CheckboxView.idl</DependentUpon>
|
|
138
|
+
</ClCompile>
|
|
139
|
+
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
|
140
|
+
<ClCompile Include="ReactPackageProvider.cpp">
|
|
141
|
+
<DependentUpon>ReactPackageProvider.idl</DependentUpon>
|
|
142
|
+
</ClCompile>
|
|
143
|
+
</ItemGroup>
|
|
144
|
+
<ItemGroup>
|
|
145
|
+
<Midl Include="CheckboxView.idl" />
|
|
146
|
+
<Midl Include="ReactPackageProvider.idl" />
|
|
147
|
+
</ItemGroup>
|
|
148
|
+
<ItemGroup>
|
|
149
|
+
<None Include="CheckboxWindows.def" />
|
|
150
|
+
</ItemGroup>
|
|
151
|
+
<ItemGroup>
|
|
152
|
+
<None Include="packages.config" />
|
|
153
|
+
<None Include="PropertySheet.props" />
|
|
154
|
+
<Text Include="readme.txt">
|
|
155
|
+
<DeploymentContent>false</DeploymentContent>
|
|
156
|
+
</Text>
|
|
157
|
+
</ItemGroup>
|
|
158
|
+
<ItemGroup>
|
|
159
|
+
<ProjectReference Include="$(ReactNativeWindowsDir)\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj">
|
|
160
|
+
<Project>{f7d32bd0-2749-483e-9a0d-1635ef7e3136}</Project>
|
|
161
|
+
<Private>false</Private>
|
|
162
|
+
</ProjectReference>
|
|
163
|
+
</ItemGroup>
|
|
164
|
+
<ItemGroup>
|
|
165
|
+
<ResourceCompile Include="CheckboxWindows.rc" />
|
|
166
|
+
</ItemGroup>
|
|
167
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
168
|
+
<ImportGroup Label="ReactNativeWindowsTargets">
|
|
169
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" />
|
|
170
|
+
</ImportGroup>
|
|
171
|
+
<Target Name="EnsureReactNativeWindowsTargets" BeforeTargets="PrepareForBuild">
|
|
172
|
+
<PropertyGroup>
|
|
173
|
+
<ErrorText>This project references targets in your node_modules\react-native-windows folder. The missing file is {0}.</ErrorText>
|
|
174
|
+
</PropertyGroup>
|
|
175
|
+
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props'))" />
|
|
176
|
+
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets'))" />
|
|
177
|
+
</Target>
|
|
178
|
+
<ImportGroup Label="ExtensionTargets">
|
|
179
|
+
<Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
|
180
|
+
</ImportGroup>
|
|
181
|
+
<Target Name="Deploy" />
|
|
182
|
+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
|
183
|
+
<PropertyGroup>
|
|
184
|
+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
|
185
|
+
</PropertyGroup>
|
|
186
|
+
<Error Condition="!Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
|
187
|
+
<Error Condition="!Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
|
188
|
+
</Target>
|
|
189
|
+
</Project>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<ItemGroup>
|
|
4
|
+
<Filter Include="Resources">
|
|
5
|
+
<UniqueIdentifier>accd3aa8-1ba0-4223-9bbe-0c431709210b</UniqueIdentifier>
|
|
6
|
+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tga;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
7
|
+
</Filter>
|
|
8
|
+
<Filter Include="Generated Files">
|
|
9
|
+
<UniqueIdentifier>{926ab91d-31b4-48c3-b9a4-e681349f27f0}</UniqueIdentifier>
|
|
10
|
+
</Filter>
|
|
11
|
+
</ItemGroup>
|
|
12
|
+
<ItemGroup>
|
|
13
|
+
<ClCompile Include="pch.cpp" />
|
|
14
|
+
<ClCompile Include="CheckboxViewManager.cpp" />
|
|
15
|
+
<ClCompile Include="ReactPackageProvider.cpp" />
|
|
16
|
+
<ClCompile Include="CheckboxView.cpp" />
|
|
17
|
+
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
|
18
|
+
</ItemGroup>
|
|
19
|
+
<ItemGroup>
|
|
20
|
+
<ClInclude Include="pch.h" />
|
|
21
|
+
<ClInclude Include="CheckboxViewManager.h" />
|
|
22
|
+
<ClInclude Include="resource.h" />
|
|
23
|
+
</ItemGroup>
|
|
24
|
+
<ItemGroup>
|
|
25
|
+
<Midl Include="CheckboxView.idl" />
|
|
26
|
+
<Midl Include="ReactPackageProvider.idl" />
|
|
27
|
+
</ItemGroup>
|
|
28
|
+
<ItemGroup>
|
|
29
|
+
<None Include="CheckboxWindows.def" />
|
|
30
|
+
<None Include="packages.config" />
|
|
31
|
+
</ItemGroup>
|
|
32
|
+
<ItemGroup>
|
|
33
|
+
<None Include="PropertySheet.props" />
|
|
34
|
+
</ItemGroup>
|
|
35
|
+
<ItemGroup>
|
|
36
|
+
<Text Include="readme.txt" />
|
|
37
|
+
</ItemGroup>
|
|
38
|
+
<ItemGroup>
|
|
39
|
+
<ResourceCompile Include="CheckboxWindows.rc">
|
|
40
|
+
<Filter>Resources</Filter>
|
|
41
|
+
</ResourceCompile>
|
|
42
|
+
</ItemGroup>
|
|
43
|
+
</Project>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<ImportGroup Label="PropertySheets" />
|
|
4
|
+
<PropertyGroup Label="UserMacros" />
|
|
5
|
+
<!--
|
|
6
|
+
To customize common C++/WinRT project properties:
|
|
7
|
+
* right-click the project node
|
|
8
|
+
* expand the Common Properties item
|
|
9
|
+
* select the C++/WinRT property page
|
|
10
|
+
|
|
11
|
+
For more advanced scenarios, and complete documentation, please see:
|
|
12
|
+
https://github.com/Microsoft/cppwinrt/tree/master/nuget
|
|
13
|
+
-->
|
|
14
|
+
<PropertyGroup />
|
|
15
|
+
<ItemDefinitionGroup />
|
|
16
|
+
</Project>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
#include "ReactPackageProvider.h"
|
|
6
|
+
#include "ReactPackageProvider.g.cpp"
|
|
7
|
+
|
|
8
|
+
#include "CheckboxViewManager.h"
|
|
9
|
+
|
|
10
|
+
using namespace winrt::Microsoft::ReactNative;
|
|
11
|
+
|
|
12
|
+
namespace winrt::CheckboxWindows::implementation {
|
|
13
|
+
|
|
14
|
+
void ReactPackageProvider::CreatePackage(IReactPackageBuilder const& packageBuilder) noexcept {
|
|
15
|
+
packageBuilder.AddViewManager(L"CheckboxViewManager", []() { return winrt::make<CheckboxViewManager>(); });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|