@solidx/checkbox 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NuGet.config +11 -0
- package/RNCCheckbox.podspec +3 -3
- package/android/build.gradle +19 -8
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/reactnativecommunity/checkbox/ReactCheckBoxEvent.java +3 -8
- package/android/src/main/java/com/reactnativecommunity/checkbox/ReactCheckBoxManager.java +7 -13
- package/dist/js/AndroidCheckBoxNativeComponent.d.ts +2 -0
- package/dist/{AndroidCheckBoxNativeComponent.js → js/AndroidCheckBoxNativeComponent.js} +1 -1
- package/dist/{CheckBox.android.d.ts → js/CheckBox.android.d.ts} +13 -13
- package/dist/{CheckBox.android.js → js/CheckBox.android.js} +7 -5
- package/dist/js/CheckBox.d.ts +5 -0
- package/dist/{CheckBox.ios.d.ts → js/CheckBox.ios.d.ts} +25 -25
- package/dist/{CheckBox.ios.js → js/CheckBox.ios.js} +11 -5
- package/dist/js/CheckBox.js +27 -0
- package/dist/js/CheckBox.windows.d.ts +95 -0
- package/dist/{CheckBox.windows.js → js/CheckBox.windows.js} +20 -21
- package/dist/js/CheckboxNativeComponent.d.ts +11 -0
- package/dist/js/CheckboxNativeComponent.js +22 -0
- package/dist/js/IOSCheckBoxNativeComponent.d.ts +2 -0
- package/dist/{IOSCheckBoxNativeComponent.js → js/IOSCheckBoxNativeComponent.js} +1 -1
- package/dist/js/NativeCheckboxModule.d.ts +11 -0
- package/dist/js/NativeCheckboxModule.js +10 -0
- package/dist/js/RNCCheckboxNativeComponent.d.ts +48 -0
- package/dist/js/RNCCheckboxNativeComponent.js +12 -0
- package/dist/js/index.d.ts +11 -0
- package/dist/js/index.js +34 -0
- package/dist/{setAndForwardRef.d.ts → js/setAndForwardRef.d.ts} +1 -1
- package/dist/{setAndForwardRef.js → js/setAndForwardRef.js} +2 -1
- package/jest.config.windows.js +3 -0
- package/js/AndroidCheckBoxNativeComponent.ts +12 -0
- package/js/CheckBox.android.tsx +217 -0
- package/js/CheckBox.ios.tsx +175 -0
- package/js/CheckBox.ts +9 -0
- package/js/CheckBox.windows.tsx +158 -0
- package/js/CheckboxNativeComponent.ts +25 -0
- package/js/IOSCheckBoxNativeComponent.ts +12 -0
- package/js/NativeCheckboxModule.ts +15 -0
- package/js/RNCCheckboxNativeComponent.ts +68 -0
- package/js/index.ts +17 -0
- package/js/setAndForwardRef.ts +64 -0
- package/metro.config.js +45 -0
- package/package.json +61 -53
- package/react-native.config.js +22 -0
- package/typings/index.d.ts +5 -5
- package/windows/Checkbox/Checkbox.cpp +20 -0
- package/windows/Checkbox/Checkbox.h +26 -0
- package/windows/Checkbox/Checkbox.rc +0 -0
- package/windows/Checkbox/Checkbox.vcxproj +146 -0
- package/windows/Checkbox/Checkbox.vcxproj.filters +56 -0
- package/windows/Checkbox/CheckboxView.cpp +186 -0
- package/windows/Checkbox/CheckboxView.h +59 -0
- package/windows/Checkbox/ReactPackageProvider.cpp +24 -0
- package/windows/Checkbox/ReactPackageProvider.h +24 -0
- package/windows/Checkbox/ReactPackageProvider.idl +9 -0
- package/windows/Checkbox/codegen/.clang-format +2 -0
- package/windows/Checkbox/codegen/NativeCheckboxModuleSpec.g.h +31 -0
- package/windows/Checkbox/codegen_manual/react/components/RNCCheckboxSpec/RNCCheckbox.g.h +232 -0
- package/windows/Checkbox/packages.lock.json +151 -0
- package/windows/Checkbox/pch.cpp +1 -0
- package/windows/Checkbox/pch.h +43 -0
- package/windows/Checkbox/resource.h +5 -0
- package/windows/Checkbox/targetver.h +8 -0
- package/windows/Checkbox.sln +43 -0
- package/windows/ExperimentalFeatures.props +33 -0
- package/dist/AndroidCheckBoxNativeComponent.d.ts +0 -2
- package/dist/CheckBox.d.ts +0 -1
- package/dist/CheckBox.js +0 -2
- package/dist/CheckBox.windows.d.ts +0 -77
- package/dist/IOSCheckBoxNativeComponent.d.ts +0 -2
- package/dist/WindowsCheckBoxComponent.d.ts +0 -2
- package/dist/WindowsCheckBoxComponent.js +0 -6
- package/windows/CheckboxWindows/CheckboxView.cpp +0 -116
- package/windows/CheckboxWindows/CheckboxView.h +0 -33
- package/windows/CheckboxWindows/CheckboxView.idl +0 -11
- package/windows/CheckboxWindows/CheckboxViewManager.cpp +0 -73
- package/windows/CheckboxWindows/CheckboxViewManager.h +0 -44
- package/windows/CheckboxWindows/CheckboxWindows.rc +0 -0
- package/windows/CheckboxWindows/CheckboxWindows.vcxproj +0 -189
- package/windows/CheckboxWindows/CheckboxWindows.vcxproj.filters +0 -43
- package/windows/CheckboxWindows/PropertySheet.props +0 -16
- package/windows/CheckboxWindows/ReactPackageProvider.cpp +0 -18
- package/windows/CheckboxWindows/ReactPackageProvider.h +0 -23
- package/windows/CheckboxWindows/ReactPackageProvider.idl +0 -9
- package/windows/CheckboxWindows/packages.config +0 -4
- package/windows/CheckboxWindows/pch.cpp +0 -1
- package/windows/CheckboxWindows/pch.h +0 -4
- package/windows/CheckboxWindows/readme.txt +0 -23
- package/windows/CheckboxWindows/resource.h +0 -14
- package/windows/CheckboxWindows.sln +0 -226
- package/windows/CheckboxWindows62.sln +0 -254
- /package/windows/{CheckboxWindows/CheckboxWindows.def → Checkbox/Checkbox.def} +0 -0
package/package.json
CHANGED
|
@@ -1,78 +1,86 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidx/checkbox",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "React Native Checkbox native modules for Android
|
|
5
|
-
"keywords": [
|
|
6
|
-
|
|
7
|
-
"react native",
|
|
8
|
-
"react-native"
|
|
9
|
-
],
|
|
10
|
-
"homepage": "https://github.com/react-native-community/react-native-checkbox#readme",
|
|
3
|
+
"version": "0.7.1",
|
|
4
|
+
"description": "React Native Checkbox native modules for Android, iOS, and Windows",
|
|
5
|
+
"keywords": ["checkbox", "react native", "react-native"],
|
|
6
|
+
"homepage": "https://github.com/dsolimando/react-native-checkbox#readme",
|
|
11
7
|
"repository": {
|
|
12
8
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/
|
|
9
|
+
"url": "https://github.com/dsolimando/react-native-checkbox.git"
|
|
14
10
|
},
|
|
15
11
|
"license": "MIT",
|
|
16
12
|
"author": "Nicholas Lee <nicholaslee119@gmail.com>",
|
|
17
|
-
"main": "dist/CheckBox",
|
|
13
|
+
"main": "dist/js/CheckBox",
|
|
18
14
|
"types": "typings/index.d.ts",
|
|
15
|
+
|
|
19
16
|
"scripts": {
|
|
20
|
-
"build": "tsc"
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"prepack": "yarn build",
|
|
19
|
+
"windows": "npx @react-native-community/cli run-windows",
|
|
20
|
+
"test:windows": "jest --config jest.config.windows.js"
|
|
21
21
|
},
|
|
22
|
+
|
|
22
23
|
"devDependencies": {
|
|
23
|
-
"@babel/core": "^7.
|
|
24
|
-
"@
|
|
25
|
-
"@react-native
|
|
26
|
-
"@react-native
|
|
27
|
-
"@
|
|
28
|
-
"@types/
|
|
29
|
-
"@types/react
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"eslint
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"react
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
24
|
+
"@babel/core": "^7.25.0",
|
|
25
|
+
"@eslint/js": "^9.10.0",
|
|
26
|
+
"@react-native/babel-preset": "0.88.1",
|
|
27
|
+
"@react-native/jest-preset": "0.88.1",
|
|
28
|
+
"@testing-library/react-native": "^13.3.3",
|
|
29
|
+
"@types/jest": "^29.5.12",
|
|
30
|
+
"@types/react": "^19.3.0",
|
|
31
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
32
|
+
"babel-plugin-module-resolver": "^5.0.0",
|
|
33
|
+
"detox": "^20.17.0",
|
|
34
|
+
"eslint": "^9.10.0",
|
|
35
|
+
"eslint-config-prettier": "^9.1.0",
|
|
36
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
37
|
+
"jest": "^29.7.0",
|
|
38
|
+
"typescript-eslint": "^8.20.0",
|
|
39
|
+
"metro-config": "^0.81.0",
|
|
40
|
+
"prettier": "^3.2.5",
|
|
41
|
+
"react": "19.3.0",
|
|
42
|
+
"react-native": "0.88.1",
|
|
43
|
+
"react-native-windows": "0.82.3",
|
|
44
|
+
"react-test-renderer": "19.3.0",
|
|
45
|
+
"typescript": "^5.7.0",
|
|
46
|
+
"xcpretty": "0.2.8001",
|
|
47
|
+
"@rnx-kit/jest-preset": "0.3.0"
|
|
44
48
|
},
|
|
49
|
+
|
|
45
50
|
"peerDependencies": {
|
|
46
|
-
"react": "
|
|
47
|
-
"react-native": ">=
|
|
48
|
-
"react-native-windows": ">=0.
|
|
51
|
+
"react": ">=19.3.0",
|
|
52
|
+
"react-native": ">=0.88.1",
|
|
53
|
+
"react-native-windows": ">=0.63"
|
|
49
54
|
},
|
|
55
|
+
|
|
50
56
|
"peerDependenciesMeta": {
|
|
51
57
|
"react-native-windows": {
|
|
52
58
|
"optional": true
|
|
53
59
|
}
|
|
54
60
|
},
|
|
61
|
+
|
|
62
|
+
"codegenConfig": {
|
|
63
|
+
"name": "RNCCheckboxSpec",
|
|
64
|
+
"type": "all",
|
|
65
|
+
"jsSrcsDir": "js",
|
|
66
|
+
"windows": {
|
|
67
|
+
"namespace": "CheckboxCodegen",
|
|
68
|
+
"outputDirectory": "windows/Checkbox/codegen",
|
|
69
|
+
"separateDataTypes": true,
|
|
70
|
+
"modulesWindows": true,
|
|
71
|
+
"componentsWindows": true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
55
75
|
"publishConfig": {
|
|
56
76
|
"access": "public"
|
|
57
77
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
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
|
|
78
|
+
|
|
79
|
+
"react-native-windows": {
|
|
80
|
+
"init-windows": {
|
|
81
|
+
"name": "Checkbox",
|
|
82
|
+
"namespace": "Checkbox",
|
|
83
|
+
"template": "cpp-lib"
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
86
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// react-native.config.js
|
|
2
|
+
module.exports = {
|
|
3
|
+
dependency: {
|
|
4
|
+
platforms: {
|
|
5
|
+
windows: {
|
|
6
|
+
sourceDir: 'windows',
|
|
7
|
+
solutionFile: 'Checkbox.sln',
|
|
8
|
+
projects: [
|
|
9
|
+
{
|
|
10
|
+
projectFile: 'Checkbox\\Checkbox.vcxproj',
|
|
11
|
+
projectName: 'Checkbox',
|
|
12
|
+
projectLang: 'cpp',
|
|
13
|
+
projectGuid: '{87A42D22-4DC5-4BDD-A12A-C90CD1B75FF6}',
|
|
14
|
+
directDependency: true,
|
|
15
|
+
cppHeaders: ['winrt/Checkbox.h'],
|
|
16
|
+
cppPackageProviders: ['Checkbox::ReactPackageProvider'],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
package/typings/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {Component} from 'react';
|
|
2
|
-
import {
|
|
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';
|
|
2
|
+
import {HostInstance} from 'react-native';
|
|
3
|
+
import {Props as AndroidProps} from '../dist/js/CheckBox.android';
|
|
4
|
+
import {Props as IOSProps} from '../dist/js/CheckBox.ios';
|
|
5
|
+
import {Props as WindowsProps} from '../dist/js/CheckBox.windows';
|
|
6
6
|
|
|
7
7
|
type Constructor<T> = new (...args: any[]) => T;
|
|
8
8
|
|
|
9
9
|
type CheckBoxProps = AndroidProps & IOSProps & WindowsProps;
|
|
10
10
|
|
|
11
11
|
declare class CheckBoxComponent extends Component<CheckBoxProps> {}
|
|
12
|
-
declare const CheckBoxBase: Constructor<
|
|
12
|
+
declare const CheckBoxBase: Constructor<HostInstance> &
|
|
13
13
|
typeof CheckBoxComponent;
|
|
14
14
|
export default class CheckBox extends CheckBoxBase {}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
#include "Checkbox.h"
|
|
6
|
+
|
|
7
|
+
using namespace winrt;
|
|
8
|
+
using namespace winrt::Microsoft::ReactNative;
|
|
9
|
+
|
|
10
|
+
namespace winrt::Checkbox::implementation {
|
|
11
|
+
|
|
12
|
+
void CheckboxModule::Initialize(ReactContext const &reactContext) noexcept {
|
|
13
|
+
m_reactContext = reactContext;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
void RegisterCheckboxNativeModule(IReactPackageBuilder const &packageBuilder) noexcept {
|
|
17
|
+
AddAttributedModules(packageBuilder, true);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
} // namespace winrt::Checkbox::implementation
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include "pch.h"
|
|
7
|
+
#include <NativeModules.h>
|
|
8
|
+
#include "codegen/NativeCheckboxModuleSpec.g.h"
|
|
9
|
+
|
|
10
|
+
namespace winrt::Checkbox::implementation {
|
|
11
|
+
|
|
12
|
+
REACT_MODULE(CheckboxModule, L"Checkbox")
|
|
13
|
+
struct CheckboxModule {
|
|
14
|
+
using ModuleSpec = CheckboxCodegen::CheckboxModuleSpec;
|
|
15
|
+
|
|
16
|
+
REACT_INIT(Initialize)
|
|
17
|
+
void Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
|
|
18
|
+
|
|
19
|
+
private:
|
|
20
|
+
winrt::Microsoft::ReactNative::ReactContext m_reactContext{nullptr};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
void RegisterCheckboxNativeModule(
|
|
24
|
+
winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder) noexcept;
|
|
25
|
+
|
|
26
|
+
} // namespace winrt::Checkbox::implementation
|
|
Binary file
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- This project was created with react-native-windows 0.80.1 -->
|
|
3
|
+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
4
|
+
<Import Project="$(SolutionDir)\ExperimentalFeatures.props" Condition="Exists('$(SolutionDir)\ExperimentalFeatures.props')" />
|
|
5
|
+
<PropertyGroup Label="Globals">
|
|
6
|
+
<CppWinRTOptimized>true</CppWinRTOptimized>
|
|
7
|
+
<MinimalCoreWin>true</MinimalCoreWin>
|
|
8
|
+
<ProjectGuid>{C11CCEDE-33B9-47AD-AAD4-447924A81ED2}</ProjectGuid>
|
|
9
|
+
<ProjectName>Checkbox</ProjectName>
|
|
10
|
+
<Keyword>Win32Proj</Keyword>
|
|
11
|
+
<RootNamespace>Checkbox</RootNamespace>
|
|
12
|
+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
|
13
|
+
<DefaultLanguage>en-US</DefaultLanguage>
|
|
14
|
+
<MinimumVisualStudioVersion>17.0</MinimumVisualStudioVersion>
|
|
15
|
+
<AppxPackage>false</AppxPackage>
|
|
16
|
+
</PropertyGroup>
|
|
17
|
+
<PropertyGroup Label="ReactNativeWindowsProps">
|
|
18
|
+
<ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
|
|
19
|
+
<RunAutolinkCheck>false</RunAutolinkCheck>
|
|
20
|
+
</PropertyGroup>
|
|
21
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.WindowsSdk.Default.props" />
|
|
22
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
23
|
+
<ItemGroup Label="ProjectConfigurations">
|
|
24
|
+
<ProjectConfiguration Include="Debug|Win32">
|
|
25
|
+
<Configuration>Debug</Configuration>
|
|
26
|
+
<Platform>Win32</Platform>
|
|
27
|
+
</ProjectConfiguration>
|
|
28
|
+
<ProjectConfiguration Include="Release|Win32">
|
|
29
|
+
<Configuration>Release</Configuration>
|
|
30
|
+
<Platform>Win32</Platform>
|
|
31
|
+
</ProjectConfiguration>
|
|
32
|
+
<ProjectConfiguration Include="Debug|x64">
|
|
33
|
+
<Configuration>Debug</Configuration>
|
|
34
|
+
<Platform>x64</Platform>
|
|
35
|
+
</ProjectConfiguration>
|
|
36
|
+
<ProjectConfiguration Include="Release|x64">
|
|
37
|
+
<Configuration>Release</Configuration>
|
|
38
|
+
<Platform>x64</Platform>
|
|
39
|
+
</ProjectConfiguration>
|
|
40
|
+
<ProjectConfiguration Include="Debug|ARM64">
|
|
41
|
+
<Configuration>Debug</Configuration>
|
|
42
|
+
<Platform>ARM64</Platform>
|
|
43
|
+
</ProjectConfiguration>
|
|
44
|
+
<ProjectConfiguration Include="Release|ARM64">
|
|
45
|
+
<Configuration>Release</Configuration>
|
|
46
|
+
<Platform>ARM64</Platform>
|
|
47
|
+
</ProjectConfiguration>
|
|
48
|
+
</ItemGroup>
|
|
49
|
+
<PropertyGroup Label="Configuration">
|
|
50
|
+
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
51
|
+
<CharacterSet>Unicode</CharacterSet>
|
|
52
|
+
<PlatformToolset>v143</PlatformToolset>
|
|
53
|
+
<GenerateManifest>false</GenerateManifest>
|
|
54
|
+
</PropertyGroup>
|
|
55
|
+
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
|
56
|
+
<UseDebugLibraries>true</UseDebugLibraries>
|
|
57
|
+
</PropertyGroup>
|
|
58
|
+
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
|
59
|
+
<UseDebugLibraries>false</UseDebugLibraries>
|
|
60
|
+
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
61
|
+
</PropertyGroup>
|
|
62
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
63
|
+
<ImportGroup Label="ExtensionSettings">
|
|
64
|
+
</ImportGroup>
|
|
65
|
+
<ImportGroup Label="PropertySheets">
|
|
66
|
+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
67
|
+
</ImportGroup>
|
|
68
|
+
<ImportGroup Label="ReactNativeWindowsPropertySheets">
|
|
69
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.CppLib.props" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.CppLib.props')" />
|
|
70
|
+
</ImportGroup>
|
|
71
|
+
<ItemDefinitionGroup>
|
|
72
|
+
<ClCompile>
|
|
73
|
+
<PrecompiledHeader>Use</PrecompiledHeader>
|
|
74
|
+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
|
75
|
+
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
|
76
|
+
<WarningLevel>Level4</WarningLevel>
|
|
77
|
+
<SDLCheck>true</SDLCheck>
|
|
78
|
+
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
|
|
79
|
+
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
|
80
|
+
<PreprocessorDefinitions>RNW_NEW_ARCH;_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
81
|
+
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
|
82
|
+
<LanguageStandard>stdcpp20</LanguageStandard>
|
|
83
|
+
<AdditionalIncludeDirectories>
|
|
84
|
+
$(MSBuildThisFileDirectory);
|
|
85
|
+
%(AdditionalIncludeDirectories)
|
|
86
|
+
</AdditionalIncludeDirectories>
|
|
87
|
+
</ClCompile>
|
|
88
|
+
<Link>
|
|
89
|
+
<AdditionalDependencies>shell32.lib;user32.lib;windowsapp.lib;%(AdditionalDependenices)</AdditionalDependencies>
|
|
90
|
+
<SubSystem>Console</SubSystem>
|
|
91
|
+
<GenerateWindowsMetadata>true</GenerateWindowsMetadata>
|
|
92
|
+
<ModuleDefinitionFile>Checkbox.def</ModuleDefinitionFile>
|
|
93
|
+
</Link>
|
|
94
|
+
</ItemDefinitionGroup>
|
|
95
|
+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
|
96
|
+
<ClCompile>
|
|
97
|
+
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
98
|
+
</ClCompile>
|
|
99
|
+
</ItemDefinitionGroup>
|
|
100
|
+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
|
101
|
+
<ClCompile>
|
|
102
|
+
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
103
|
+
</ClCompile>
|
|
104
|
+
</ItemDefinitionGroup>
|
|
105
|
+
<PropertyGroup Label="UserMacros" />
|
|
106
|
+
<ItemGroup>
|
|
107
|
+
<ClInclude Include="Checkbox.h" />
|
|
108
|
+
<ClInclude Include="CheckboxView.h" />
|
|
109
|
+
<ClInclude Include="ReactPackageProvider.h">
|
|
110
|
+
<DependentUpon>ReactPackageProvider.idl</DependentUpon>
|
|
111
|
+
</ClInclude>
|
|
112
|
+
<ClInclude Include="resource.h" />
|
|
113
|
+
<ClInclude Include="pch.h" />
|
|
114
|
+
<ClInclude Include="targetver.h" />
|
|
115
|
+
</ItemGroup>
|
|
116
|
+
<ItemGroup>
|
|
117
|
+
<ClCompile Include="Checkbox.cpp" />
|
|
118
|
+
<ClCompile Include="CheckboxView.cpp" />
|
|
119
|
+
<ClCompile Include="pch.cpp">
|
|
120
|
+
<PrecompiledHeader>Create</PrecompiledHeader>
|
|
121
|
+
</ClCompile>
|
|
122
|
+
<ClCompile Include="ReactPackageProvider.cpp">
|
|
123
|
+
<DependentUpon>ReactPackageProvider.idl</DependentUpon>
|
|
124
|
+
</ClCompile>
|
|
125
|
+
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
|
|
126
|
+
</ItemGroup>
|
|
127
|
+
<ItemGroup>
|
|
128
|
+
<Midl Include="ReactPackageProvider.idl" />
|
|
129
|
+
</ItemGroup>
|
|
130
|
+
<ItemGroup>
|
|
131
|
+
<ResourceCompile Include="Checkbox.rc" />
|
|
132
|
+
</ItemGroup>
|
|
133
|
+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
134
|
+
<ImportGroup Label="ReactNativeWindowsTargets">
|
|
135
|
+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.CppLib.targets" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.CppLib.targets')" />
|
|
136
|
+
</ImportGroup>
|
|
137
|
+
<ItemGroup>
|
|
138
|
+
</ItemGroup>
|
|
139
|
+
<Target Name="EnsureReactNativeWindowsTargets" BeforeTargets="PrepareForBuild">
|
|
140
|
+
<PropertyGroup>
|
|
141
|
+
<ErrorText>This project references targets in your node_modules\react-native-windows folder. The missing file is {0}.</ErrorText>
|
|
142
|
+
</PropertyGroup>
|
|
143
|
+
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.CppLib.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.CppLib.props'))" />
|
|
144
|
+
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.CppLib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.CppLib.targets'))" />
|
|
145
|
+
</Target>
|
|
146
|
+
</Project>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
|
+
<ItemGroup>
|
|
4
|
+
<Filter Include="Source Files">
|
|
5
|
+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
6
|
+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
7
|
+
</Filter>
|
|
8
|
+
<Filter Include="Header Files">
|
|
9
|
+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
10
|
+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
|
11
|
+
</Filter>
|
|
12
|
+
<Filter Include="Resource Files">
|
|
13
|
+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
|
14
|
+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
15
|
+
</Filter>
|
|
16
|
+
</ItemGroup>
|
|
17
|
+
<ItemGroup>
|
|
18
|
+
<ClInclude Include="targetver.h">
|
|
19
|
+
<Filter>Header Files</Filter>
|
|
20
|
+
</ClInclude>
|
|
21
|
+
<ClInclude Include="resource.h">
|
|
22
|
+
<Filter>Header Files</Filter>
|
|
23
|
+
</ClInclude>
|
|
24
|
+
<ClInclude Include="Checkbox.h">
|
|
25
|
+
<Filter>Header Files</Filter>
|
|
26
|
+
</ClInclude>
|
|
27
|
+
<ClInclude Include="CheckboxView.h">
|
|
28
|
+
<Filter>Header Files</Filter>
|
|
29
|
+
</ClInclude>
|
|
30
|
+
<ClInclude Include="ReactPackageProvider.h">
|
|
31
|
+
<Filter>Header Files</Filter>
|
|
32
|
+
</ClInclude>
|
|
33
|
+
<ClInclude Include="pch.h">
|
|
34
|
+
<Filter>Header Files</Filter>
|
|
35
|
+
</ClInclude>
|
|
36
|
+
</ItemGroup>
|
|
37
|
+
<ItemGroup>
|
|
38
|
+
<ClCompile Include="Checkbox.cpp">
|
|
39
|
+
<Filter>Source Files</Filter>
|
|
40
|
+
</ClCompile>
|
|
41
|
+
<ClCompile Include="CheckboxView.cpp">
|
|
42
|
+
<Filter>Source Files</Filter>
|
|
43
|
+
</ClCompile>
|
|
44
|
+
<ClCompile Include="ReactPackageProvider.cpp">
|
|
45
|
+
<Filter>Source Files</Filter>
|
|
46
|
+
</ClCompile>
|
|
47
|
+
<ClCompile Include="pch.cpp">
|
|
48
|
+
<Filter>Source Files</Filter>
|
|
49
|
+
</ClCompile>
|
|
50
|
+
</ItemGroup>
|
|
51
|
+
<ItemGroup>
|
|
52
|
+
<ResourceCompile Include="Checkbox.rc">
|
|
53
|
+
<Filter>Resource Files</Filter>
|
|
54
|
+
</ResourceCompile>
|
|
55
|
+
</ItemGroup>
|
|
56
|
+
</Project>
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
#include "CheckboxView.h"
|
|
6
|
+
#include <limits>
|
|
7
|
+
|
|
8
|
+
namespace winrt::Checkbox::implementation {
|
|
9
|
+
|
|
10
|
+
void RegisterCheckboxComponentView(
|
|
11
|
+
winrt::Microsoft::ReactNative::IReactPackageBuilder const& packageBuilder) noexcept {
|
|
12
|
+
CheckboxCodegen::RegisterRNCCheckboxNativeComponent<winrt::Checkbox::implementation::RNCCheckboxComponentView>(
|
|
13
|
+
packageBuilder,
|
|
14
|
+
[](const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder& builder) {
|
|
15
|
+
builder.as<winrt::Microsoft::ReactNative::IReactViewComponentBuilder>().XamlSupport(true);
|
|
16
|
+
// Use SetContentIslandComponentViewInitializer
|
|
17
|
+
builder.SetContentIslandComponentViewInitializer(
|
|
18
|
+
[](const winrt::Microsoft::ReactNative::Composition::ContentIslandComponentView& islandView) noexcept {
|
|
19
|
+
auto userData = winrt::make_self<winrt::Checkbox::implementation::RNCCheckboxComponentView>();
|
|
20
|
+
userData->InitializeContentIsland(islandView);
|
|
21
|
+
islandView.UserData(*userData);
|
|
22
|
+
});
|
|
23
|
+
// Set up initial state with zero size
|
|
24
|
+
builder.as<winrt::Microsoft::ReactNative::IReactViewComponentBuilder>().SetInitialStateDataFactory(
|
|
25
|
+
[](const winrt::Microsoft::ReactNative::IComponentProps& /*props*/) noexcept {
|
|
26
|
+
return winrt::make<RNCCheckboxStateData>(winrt::Windows::Foundation::Size{ 0, 0 });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// Register the measure function - reads from state
|
|
30
|
+
builder.as<winrt::Microsoft::ReactNative::IReactViewComponentBuilder>().SetMeasureContentHandler(
|
|
31
|
+
[](winrt::Microsoft::ReactNative::ShadowNode const& shadowNode,
|
|
32
|
+
winrt::Microsoft::ReactNative::LayoutContext const&,
|
|
33
|
+
winrt::Microsoft::ReactNative::LayoutConstraints const&) noexcept {
|
|
34
|
+
|
|
35
|
+
auto currentState = winrt::get_self<RNCCheckboxStateData>(shadowNode.StateData());
|
|
36
|
+
|
|
37
|
+
if (currentState && currentState->desiredSize.Width > 0) {
|
|
38
|
+
// Return the measured size from state
|
|
39
|
+
return currentState->desiredSize;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Return a default size if we don't have a measurement yet
|
|
43
|
+
return winrt::Windows::Foundation::Size{ 32, 32 };
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Handle state updates
|
|
47
|
+
builder.as<winrt::Microsoft::ReactNative::IReactViewComponentBuilder>().SetUpdateStateHandler(
|
|
48
|
+
[](const winrt::Microsoft::ReactNative::ComponentView& view,
|
|
49
|
+
const winrt::Microsoft::ReactNative::IComponentState& newState) {
|
|
50
|
+
auto islandView = view.as<winrt::Microsoft::ReactNative::Composition::ContentIslandComponentView>();
|
|
51
|
+
auto userData = islandView.UserData().as<winrt::Checkbox::implementation::RNCCheckboxComponentView>();
|
|
52
|
+
userData->UpdateState(view, newState);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
void RNCCheckboxComponentView::InitializeContentIsland(
|
|
58
|
+
const winrt::Microsoft::ReactNative::Composition::ContentIslandComponentView& islandView) {
|
|
59
|
+
// Create CheckBox
|
|
60
|
+
m_checkBox = winrt::Microsoft::UI::Xaml::Controls::CheckBox();
|
|
61
|
+
m_checkBox.HorizontalAlignment(winrt::Microsoft::UI::Xaml::HorizontalAlignment::Left);
|
|
62
|
+
m_checkBox.VerticalAlignment(winrt::Microsoft::UI::Xaml::VerticalAlignment::Center);
|
|
63
|
+
|
|
64
|
+
// Subscribe to Checked/Unchecked events with auto-revokers
|
|
65
|
+
m_checkedRevoker = m_checkBox.Checked(winrt::auto_revoke, [this](auto const&, auto const&) {
|
|
66
|
+
OnCheckedChanged();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
m_uncheckedRevoker = m_checkBox.Unchecked(winrt::auto_revoke, [this](auto const&, auto const&) {
|
|
70
|
+
OnCheckedChanged();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Listen for size changes on the checkbox with auto-revoker
|
|
74
|
+
m_sizeChangedRevoker = m_checkBox.SizeChanged(winrt::auto_revoke, [this](auto const&, auto const&) {
|
|
75
|
+
RefreshSize();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
m_island = winrt::Microsoft::UI::Xaml::XamlIsland{};
|
|
79
|
+
m_island.Content(m_checkBox);
|
|
80
|
+
islandView.Connect(m_island.ContentIsland());
|
|
81
|
+
m_islandView = winrt::make_weak(islandView);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
void RNCCheckboxComponentView::UpdateProps(
|
|
85
|
+
const winrt::Microsoft::ReactNative::ComponentView& view,
|
|
86
|
+
const winrt::com_ptr<CheckboxCodegen::RNCCheckboxProps>& newProps,
|
|
87
|
+
const winrt::com_ptr<CheckboxCodegen::RNCCheckboxProps>& oldProps) noexcept {
|
|
88
|
+
BaseRNCCheckbox::UpdateProps(view, newProps, oldProps);
|
|
89
|
+
|
|
90
|
+
if (!m_checkBox) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Update value (checked state)
|
|
95
|
+
if (newProps->value.has_value()) {
|
|
96
|
+
m_checkBox.IsChecked(newProps->value.value());
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Update disabled state
|
|
100
|
+
if (newProps->disabled.has_value()) {
|
|
101
|
+
m_checkBox.IsEnabled(!newProps->disabled.value());
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
auto resDict = m_checkBox.Resources();
|
|
105
|
+
auto theme = view.as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Theme();
|
|
106
|
+
|
|
107
|
+
// onCheckColor - color of the check mark when checked
|
|
108
|
+
if (newProps->onCheckColor) {
|
|
109
|
+
auto brush = winrt::Microsoft::UI::Xaml::Media::SolidColorBrush(newProps->onCheckColor.AsWindowsColor(theme));
|
|
110
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckGlyphForegroundChecked"), brush);
|
|
111
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckGlyphForegroundCheckedPointerOver"), brush);
|
|
112
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckGlyphForegroundCheckedPressed"), brush);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// onTintColor - color of the border when checked
|
|
116
|
+
if (newProps->onTintColor) {
|
|
117
|
+
auto brush = winrt::Microsoft::UI::Xaml::Media::SolidColorBrush(newProps->onTintColor.AsWindowsColor(theme));
|
|
118
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundStrokeChecked"), brush);
|
|
119
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundStrokeCheckedPointerOver"), brush);
|
|
120
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundStrokeCheckedPressed"), brush);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// onFillColor - fill color of the box when checked
|
|
124
|
+
if (newProps->onFillColor) {
|
|
125
|
+
auto brush = winrt::Microsoft::UI::Xaml::Media::SolidColorBrush(newProps->onFillColor.AsWindowsColor(theme));
|
|
126
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillChecked"), brush);
|
|
127
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillCheckedPointerOver"), brush);
|
|
128
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillCheckedPressed"), brush);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// tintColor - color of the box when unchecked
|
|
132
|
+
if (newProps->tintColor) {
|
|
133
|
+
auto brush = winrt::Microsoft::UI::Xaml::Media::SolidColorBrush(newProps->tintColor.AsWindowsColor(theme));
|
|
134
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillUnchecked"), brush);
|
|
135
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillUncheckedPointerOver"), brush);
|
|
136
|
+
resDict.Insert(winrt::box_value(L"CheckBoxCheckBackgroundFillUncheckedPressed"), brush);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// label - text content next to the checkbox
|
|
140
|
+
if (!newProps->label.empty()) {
|
|
141
|
+
m_checkBox.Content(winrt::box_value(winrt::to_hstring(newProps->label)));
|
|
142
|
+
} else {
|
|
143
|
+
m_checkBox.Content(nullptr);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
RefreshSize();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Measure checkbox and update state if needed.
|
|
150
|
+
void RNCCheckboxComponentView::RefreshSize() {
|
|
151
|
+
if (!m_checkBox) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
m_checkBox.Measure(winrt::Windows::Foundation::Size{
|
|
156
|
+
std::numeric_limits<float>::infinity(),
|
|
157
|
+
std::numeric_limits<float>::infinity()
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
auto desiredSize = m_checkBox.DesiredSize();
|
|
161
|
+
|
|
162
|
+
if (m_state) {
|
|
163
|
+
auto currentState = winrt::get_self<RNCCheckboxStateData>(m_state.Data());
|
|
164
|
+
if (desiredSize != currentState->desiredSize) {
|
|
165
|
+
m_state.UpdateStateWithMutation([desiredSize](winrt::Windows::Foundation::IInspectable /*data*/) {
|
|
166
|
+
return winrt::make<RNCCheckboxStateData>(desiredSize);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
void RNCCheckboxComponentView::UpdateState(
|
|
173
|
+
const winrt::Microsoft::ReactNative::ComponentView& /*view*/,
|
|
174
|
+
const winrt::Microsoft::ReactNative::IComponentState& newState) noexcept {
|
|
175
|
+
m_state = newState;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
void RNCCheckboxComponentView::OnCheckedChanged() {
|
|
179
|
+
if (auto eventEmitter = EventEmitter()) {
|
|
180
|
+
CheckboxCodegen::RNCCheckboxEventEmitter::OnChange args;
|
|
181
|
+
args.value = m_checkBox.IsChecked().GetBoolean();
|
|
182
|
+
eventEmitter->onChange(args);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
} // namespace winrt::Checkbox::implementation
|