react-native-unit-components 0.1.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.
Files changed (89) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +2 -0
  3. package/android/build.gradle +145 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +4 -0
  6. package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsPackage.kt +16 -0
  7. package/android/src/main/java/com/unitreactnativecomponents/UnitReactNativeComponentsViewManager.kt +19 -0
  8. package/ios/UnitReactNativeComponents-Bridging-Header.h +1 -0
  9. package/ios/UnitReactNativeComponents.xcodeproj/project.pbxproj +283 -0
  10. package/ios/UnitReactNativeComponents.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
  11. package/ios/UnitReactNativeComponents.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  12. package/ios/UnitReactNativeComponents.xcodeproj/project.xcworkspace/xcuserdata/alonshprung.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  13. package/ios/UnitReactNativeComponents.xcodeproj/xcuserdata/alonshprung.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  14. package/ios/UnitReactNativeComponentsViewManager.m +7 -0
  15. package/ios/UnitReactNativeComponentsViewManager.swift +36 -0
  16. package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js +143 -0
  17. package/lib/commonjs/components/BottomSheet/BottomSheetComponent.js.map +1 -0
  18. package/lib/commonjs/components/Card/CardComponent.js +97 -0
  19. package/lib/commonjs/components/Card/CardComponent.js.map +1 -0
  20. package/lib/commonjs/components/index.js +32 -0
  21. package/lib/commonjs/components/index.js.map +1 -0
  22. package/lib/commonjs/helpers/BottomSheet.js +274 -0
  23. package/lib/commonjs/helpers/BottomSheet.js.map +1 -0
  24. package/lib/commonjs/helpers/EventBus.js +79 -0
  25. package/lib/commonjs/helpers/EventBus.js.map +1 -0
  26. package/lib/commonjs/index.js +19 -0
  27. package/lib/commonjs/index.js.map +1 -0
  28. package/lib/commonjs/nativeComponenet/NativeComponentExample.js +19 -0
  29. package/lib/commonjs/nativeComponenet/NativeComponentExample.js.map +1 -0
  30. package/lib/commonjs/webComponent/WebComponent.js +75 -0
  31. package/lib/commonjs/webComponent/WebComponent.js.map +1 -0
  32. package/lib/commonjs/webComponent/html.js +79 -0
  33. package/lib/commonjs/webComponent/html.js.map +1 -0
  34. package/lib/commonjs/webComponent/webMessages/cardMessage.js +13 -0
  35. package/lib/commonjs/webComponent/webMessages/cardMessage.js.map +1 -0
  36. package/lib/commonjs/webComponent/webMessages/pageMessage.js +14 -0
  37. package/lib/commonjs/webComponent/webMessages/pageMessage.js.map +1 -0
  38. package/lib/commonjs/webComponent/webMessages/unitMessages.js +17 -0
  39. package/lib/commonjs/webComponent/webMessages/unitMessages.js.map +1 -0
  40. package/lib/module/components/BottomSheet/BottomSheetComponent.js +118 -0
  41. package/lib/module/components/BottomSheet/BottomSheetComponent.js.map +1 -0
  42. package/lib/module/components/Card/CardComponent.js +75 -0
  43. package/lib/module/components/Card/CardComponent.js.map +1 -0
  44. package/lib/module/components/index.js +3 -0
  45. package/lib/module/components/index.js.map +1 -0
  46. package/lib/module/helpers/BottomSheet.js +252 -0
  47. package/lib/module/helpers/BottomSheet.js.map +1 -0
  48. package/lib/module/helpers/EventBus.js +69 -0
  49. package/lib/module/helpers/EventBus.js.map +1 -0
  50. package/lib/module/index.js +2 -0
  51. package/lib/module/index.js.map +1 -0
  52. package/lib/module/nativeComponenet/NativeComponentExample.js +10 -0
  53. package/lib/module/nativeComponenet/NativeComponentExample.js.map +1 -0
  54. package/lib/module/webComponent/WebComponent.js +49 -0
  55. package/lib/module/webComponent/WebComponent.js.map +1 -0
  56. package/lib/module/webComponent/html.js +72 -0
  57. package/lib/module/webComponent/html.js.map +1 -0
  58. package/lib/module/webComponent/webMessages/cardMessage.js +6 -0
  59. package/lib/module/webComponent/webMessages/cardMessage.js.map +1 -0
  60. package/lib/module/webComponent/webMessages/pageMessage.js +7 -0
  61. package/lib/module/webComponent/webMessages/pageMessage.js.map +1 -0
  62. package/lib/module/webComponent/webMessages/unitMessages.js +10 -0
  63. package/lib/module/webComponent/webMessages/unitMessages.js.map +1 -0
  64. package/lib/typescript/components/BottomSheet/BottomSheetComponent.d.ts +1 -0
  65. package/lib/typescript/components/Card/CardComponent.d.ts +6 -0
  66. package/lib/typescript/components/index.d.ts +2 -0
  67. package/lib/typescript/helpers/BottomSheet.d.ts +34 -0
  68. package/lib/typescript/helpers/EventBus.d.ts +15 -0
  69. package/lib/typescript/index.d.ts +1 -0
  70. package/lib/typescript/nativeComponenet/NativeComponentExample.d.ts +7 -0
  71. package/lib/typescript/webComponent/WebComponent.d.ts +23 -0
  72. package/lib/typescript/webComponent/html.d.ts +2 -0
  73. package/lib/typescript/webComponent/webMessages/cardMessage.d.ts +7 -0
  74. package/lib/typescript/webComponent/webMessages/pageMessage.d.ts +8 -0
  75. package/lib/typescript/webComponent/webMessages/unitMessages.d.ts +24 -0
  76. package/package.json +152 -0
  77. package/src/components/BottomSheet/BottomSheetComponent.tsx +113 -0
  78. package/src/components/Card/CardComponent.tsx +75 -0
  79. package/src/components/index.ts +2 -0
  80. package/src/helpers/BottomSheet.tsx +277 -0
  81. package/src/helpers/EventBus.ts +58 -0
  82. package/src/index.tsx +1 -0
  83. package/src/nativeComponenet/NativeComponentExample.tsx +26 -0
  84. package/src/webComponent/WebComponent.tsx +75 -0
  85. package/src/webComponent/html.ts +72 -0
  86. package/src/webComponent/webMessages/cardMessage.ts +10 -0
  87. package/src/webComponent/webMessages/pageMessage.ts +11 -0
  88. package/src/webComponent/webMessages/unitMessages.ts +31 -0
  89. package/unit-react-native-components.podspec +35 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Alon Shprung
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # unit-react-native-components
2
+ Unit React Native Components
@@ -0,0 +1,145 @@
1
+ buildscript {
2
+ // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
+ def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['UnitReactNativeComponents_kotlinVersion']
4
+
5
+ repositories {
6
+ google()
7
+ mavenCentral()
8
+ }
9
+
10
+ dependencies {
11
+ classpath 'com.android.tools.build:gradle:3.5.3'
12
+ // noinspection DifferentKotlinGradleVersion
13
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
+ }
15
+ }
16
+
17
+ def isNewArchitectureEnabled() {
18
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
19
+ }
20
+
21
+ apply plugin: 'com.android.library'
22
+ apply plugin: 'kotlin-android'
23
+
24
+ if (isNewArchitectureEnabled()) {
25
+ apply plugin: 'com.facebook.react'
26
+ }
27
+
28
+ def getExtOrDefault(name) {
29
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['UnitReactNativeComponents_' + name]
30
+ }
31
+
32
+ def getExtOrIntegerDefault(name) {
33
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['UnitReactNativeComponents_' + name]).toInteger()
34
+ }
35
+
36
+ android {
37
+ compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
38
+
39
+ defaultConfig {
40
+ minSdkVersion getExtOrIntegerDefault('minSdkVersion')
41
+ targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
42
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
43
+ }
44
+ buildTypes {
45
+ release {
46
+ minifyEnabled false
47
+ }
48
+ }
49
+
50
+ lintOptions {
51
+ disable 'GradleCompatible'
52
+ }
53
+
54
+ compileOptions {
55
+ sourceCompatibility JavaVersion.VERSION_1_8
56
+ targetCompatibility JavaVersion.VERSION_1_8
57
+ }
58
+ }
59
+
60
+ repositories {
61
+ mavenCentral()
62
+ google()
63
+
64
+ def found = false
65
+ def defaultDir = null
66
+ def androidSourcesName = 'React Native sources'
67
+
68
+ if (rootProject.ext.has('reactNativeAndroidRoot')) {
69
+ defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
70
+ } else {
71
+ defaultDir = new File(
72
+ projectDir,
73
+ '/../../../node_modules/react-native/android'
74
+ )
75
+ }
76
+
77
+ if (defaultDir.exists()) {
78
+ maven {
79
+ url defaultDir.toString()
80
+ name androidSourcesName
81
+ }
82
+
83
+ logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
84
+ found = true
85
+ } else {
86
+ def parentDir = rootProject.projectDir
87
+
88
+ 1.upto(5, {
89
+ if (found) return true
90
+ parentDir = parentDir.parentFile
91
+
92
+ def androidSourcesDir = new File(
93
+ parentDir,
94
+ 'node_modules/react-native'
95
+ )
96
+
97
+ def androidPrebuiltBinaryDir = new File(
98
+ parentDir,
99
+ 'node_modules/react-native/android'
100
+ )
101
+
102
+ if (androidPrebuiltBinaryDir.exists()) {
103
+ maven {
104
+ url androidPrebuiltBinaryDir.toString()
105
+ name androidSourcesName
106
+ }
107
+
108
+ logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
109
+ found = true
110
+ } else if (androidSourcesDir.exists()) {
111
+ maven {
112
+ url androidSourcesDir.toString()
113
+ name androidSourcesName
114
+ }
115
+
116
+ logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
117
+ found = true
118
+ }
119
+ })
120
+ }
121
+
122
+ if (!found) {
123
+ throw new GradleException(
124
+ "${project.name}: unable to locate React Native android sources. " +
125
+ "Ensure you have you installed React Native as a dependency in your project and try again."
126
+ )
127
+ }
128
+ }
129
+
130
+ def kotlin_version = getExtOrDefault('kotlinVersion')
131
+
132
+ dependencies {
133
+ //noinspection GradleDynamicVersion
134
+ implementation "com.facebook.react:react-native:+"
135
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
136
+ // From node_modules
137
+ }
138
+
139
+ if (isNewArchitectureEnabled()) {
140
+ react {
141
+ jsRootDir = file("../src/")
142
+ libraryName = "UnitReactNativeComponents"
143
+ codegenJavaPackageName = "com.unitreactnativecomponents"
144
+ }
145
+ }
@@ -0,0 +1,5 @@
1
+ UnitReactNativeComponents_kotlinVersion=1.7.0
2
+ UnitReactNativeComponents_minSdkVersion=21
3
+ UnitReactNativeComponents_targetSdkVersion=31
4
+ UnitReactNativeComponents_compileSdkVersion=31
5
+ UnitReactNativeComponents_ndkversion=21.4.7075529
@@ -0,0 +1,4 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.unitreactnativecomponents">
3
+
4
+ </manifest>
@@ -0,0 +1,16 @@
1
+ package com.unitreactnativecomponents
2
+ import com.facebook.react.ReactPackage
3
+ import com.facebook.react.bridge.NativeModule
4
+ import com.facebook.react.bridge.ReactApplicationContext
5
+ import com.facebook.react.uimanager.ViewManager
6
+
7
+
8
+ class UnitReactNativeComponentsPackage : ReactPackage {
9
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
10
+ return emptyList()
11
+ }
12
+
13
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
14
+ return listOf(UnitReactNativeComponentsViewManager())
15
+ }
16
+ }
@@ -0,0 +1,19 @@
1
+ package com.unitreactnativecomponents
2
+ import android.graphics.Color
3
+ import android.view.View
4
+ import com.facebook.react.uimanager.SimpleViewManager
5
+ import com.facebook.react.uimanager.ThemedReactContext
6
+ import com.facebook.react.uimanager.annotations.ReactProp
7
+
8
+ class UnitReactNativeComponentsViewManager : SimpleViewManager<View>() {
9
+ override fun getName() = "UnitReactNativeComponentsView"
10
+
11
+ override fun createViewInstance(reactContext: ThemedReactContext): View {
12
+ return View(reactContext)
13
+ }
14
+
15
+ @ReactProp(name = "color")
16
+ fun setColor(view: View, color: String) {
17
+ view.setBackgroundColor(Color.parseColor(color))
18
+ }
19
+ }
@@ -0,0 +1 @@
1
+ #import <React/RCTViewManager.h>
@@ -0,0 +1,283 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
9
+ /* Begin PBXBuildFile section */
10
+ 5E555C0D2413F4C50049A1A2 /* UnitReactNativeComponents.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* UnitReactNativeComponents.m */; };
11
+ F4FF95D7245B92E800C19C63 /* UnitReactNativeComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* UnitReactNativeComponents.swift */; };
12
+ /* End PBXBuildFile section */
13
+
14
+ /* Begin PBXCopyFilesBuildPhase section */
15
+ 58B511D91A9E6C8500147676 /* CopyFiles */ = {
16
+ isa = PBXCopyFilesBuildPhase;
17
+ buildActionMask = 2147483647;
18
+ dstPath = "include/$(PRODUCT_NAME)";
19
+ dstSubfolderSpec = 16;
20
+ files = (
21
+ );
22
+ runOnlyForDeploymentPostprocessing = 0;
23
+ };
24
+ /* End PBXCopyFilesBuildPhase section */
25
+
26
+ /* Begin PBXFileReference section */
27
+ 134814201AA4EA6300B7C361 /* libUnitReactNativeComponents.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libUnitReactNativeComponents.a; sourceTree = BUILT_PRODUCTS_DIR; };
28
+ B3E7B5891CC2AC0600A0062D /* UnitReactNativeComponents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UnitReactNativeComponents.m; sourceTree = "<group>"; };
29
+ F4FF95D5245B92E700C19C63 /* UnitReactNativeComponents-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UnitReactNativeComponents-Bridging-Header.h"; sourceTree = "<group>"; };
30
+ F4FF95D6245B92E800C19C63 /* UnitReactNativeComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnitReactNativeComponents.swift; sourceTree = "<group>"; };
31
+ /* End PBXFileReference section */
32
+
33
+ /* Begin PBXFrameworksBuildPhase section */
34
+ 58B511D81A9E6C8500147676 /* Frameworks */ = {
35
+ isa = PBXFrameworksBuildPhase;
36
+ buildActionMask = 2147483647;
37
+ files = (
38
+ );
39
+ runOnlyForDeploymentPostprocessing = 0;
40
+ };
41
+ /* End PBXFrameworksBuildPhase section */
42
+
43
+ /* Begin PBXGroup section */
44
+ 134814211AA4EA7D00B7C361 /* Products */ = {
45
+ isa = PBXGroup;
46
+ children = (
47
+ 134814201AA4EA6300B7C361 /* libUnitReactNativeComponents.a */,
48
+ );
49
+ name = Products;
50
+ sourceTree = "<group>";
51
+ };
52
+ 58B511D21A9E6C8500147676 = {
53
+ isa = PBXGroup;
54
+ children = (
55
+ F4FF95D6245B92E800C19C63 /* UnitReactNativeComponents.swift */,
56
+ B3E7B5891CC2AC0600A0062D /* UnitReactNativeComponents.m */,
57
+ F4FF95D5245B92E700C19C63 /* UnitReactNativeComponents-Bridging-Header.h */,
58
+ 134814211AA4EA7D00B7C361 /* Products */,
59
+ );
60
+ sourceTree = "<group>";
61
+ };
62
+ /* End PBXGroup section */
63
+
64
+ /* Begin PBXNativeTarget section */
65
+ 58B511DA1A9E6C8500147676 /* UnitReactNativeComponents */ = {
66
+ isa = PBXNativeTarget;
67
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "UnitReactNativeComponents" */;
68
+ buildPhases = (
69
+ 58B511D71A9E6C8500147676 /* Sources */,
70
+ 58B511D81A9E6C8500147676 /* Frameworks */,
71
+ 58B511D91A9E6C8500147676 /* CopyFiles */,
72
+ );
73
+ buildRules = (
74
+ );
75
+ dependencies = (
76
+ );
77
+ name = UnitReactNativeComponents;
78
+ productName = RCTDataManager;
79
+ productReference = 134814201AA4EA6300B7C361 /* libUnitReactNativeComponents.a */;
80
+ productType = "com.apple.product-type.library.static";
81
+ };
82
+ /* End PBXNativeTarget section */
83
+
84
+ /* Begin PBXProject section */
85
+ 58B511D31A9E6C8500147676 /* Project object */ = {
86
+ isa = PBXProject;
87
+ attributes = {
88
+ LastUpgradeCheck = 0920;
89
+ ORGANIZATIONNAME = Facebook;
90
+ TargetAttributes = {
91
+ 58B511DA1A9E6C8500147676 = {
92
+ CreatedOnToolsVersion = 6.1.1;
93
+ };
94
+ };
95
+ };
96
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "UnitReactNativeComponents" */;
97
+ compatibilityVersion = "Xcode 3.2";
98
+ developmentRegion = English;
99
+ hasScannedForEncodings = 0;
100
+ knownRegions = (
101
+ English,
102
+ en,
103
+ );
104
+ mainGroup = 58B511D21A9E6C8500147676;
105
+ productRefGroup = 58B511D21A9E6C8500147676;
106
+ projectDirPath = "";
107
+ projectRoot = "";
108
+ targets = (
109
+ 58B511DA1A9E6C8500147676 /* UnitReactNativeComponents */,
110
+ );
111
+ };
112
+ /* End PBXProject section */
113
+
114
+ /* Begin PBXSourcesBuildPhase section */
115
+ 58B511D71A9E6C8500147676 /* Sources */ = {
116
+ isa = PBXSourcesBuildPhase;
117
+ buildActionMask = 2147483647;
118
+ files = (
119
+ F4FF95D7245B92E800C19C63 /* UnitReactNativeComponents.swift in Sources */,
120
+ B3E7B58A1CC2AC0600A0062D /* UnitReactNativeComponents.m in Sources */,
121
+ );
122
+ runOnlyForDeploymentPostprocessing = 0;
123
+ };
124
+ /* End PBXSourcesBuildPhase section */
125
+
126
+ /* Begin XCBuildConfiguration section */
127
+ 58B511ED1A9E6C8500147676 /* Debug */ = {
128
+ isa = XCBuildConfiguration;
129
+ buildSettings = {
130
+ ALWAYS_SEARCH_USER_PATHS = NO;
131
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
132
+ CLANG_CXX_LIBRARY = "libc++";
133
+ CLANG_ENABLE_MODULES = YES;
134
+ CLANG_ENABLE_OBJC_ARC = YES;
135
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
136
+ CLANG_WARN_BOOL_CONVERSION = YES;
137
+ CLANG_WARN_COMMA = YES;
138
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
139
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
140
+ CLANG_WARN_EMPTY_BODY = YES;
141
+ CLANG_WARN_ENUM_CONVERSION = YES;
142
+ CLANG_WARN_INFINITE_RECURSION = YES;
143
+ CLANG_WARN_INT_CONVERSION = YES;
144
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
145
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
146
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
147
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
148
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
149
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
150
+ CLANG_WARN_UNREACHABLE_CODE = YES;
151
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
152
+ COPY_PHASE_STRIP = NO;
153
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
154
+ ENABLE_TESTABILITY = YES;
155
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
156
+ GCC_C_LANGUAGE_STANDARD = gnu99;
157
+ GCC_DYNAMIC_NO_PIC = NO;
158
+ GCC_NO_COMMON_BLOCKS = YES;
159
+ GCC_OPTIMIZATION_LEVEL = 0;
160
+ GCC_PREPROCESSOR_DEFINITIONS = (
161
+ "DEBUG=1",
162
+ "$(inherited)",
163
+ );
164
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
165
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
166
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
167
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
168
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
169
+ GCC_WARN_UNUSED_FUNCTION = YES;
170
+ GCC_WARN_UNUSED_VARIABLE = YES;
171
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
172
+ MTL_ENABLE_DEBUG_INFO = YES;
173
+ ONLY_ACTIVE_ARCH = YES;
174
+ SDKROOT = iphoneos;
175
+ };
176
+ name = Debug;
177
+ };
178
+ 58B511EE1A9E6C8500147676 /* Release */ = {
179
+ isa = XCBuildConfiguration;
180
+ buildSettings = {
181
+ ALWAYS_SEARCH_USER_PATHS = NO;
182
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
183
+ CLANG_CXX_LIBRARY = "libc++";
184
+ CLANG_ENABLE_MODULES = YES;
185
+ CLANG_ENABLE_OBJC_ARC = YES;
186
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
187
+ CLANG_WARN_BOOL_CONVERSION = YES;
188
+ CLANG_WARN_COMMA = YES;
189
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
190
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
191
+ CLANG_WARN_EMPTY_BODY = YES;
192
+ CLANG_WARN_ENUM_CONVERSION = YES;
193
+ CLANG_WARN_INFINITE_RECURSION = YES;
194
+ CLANG_WARN_INT_CONVERSION = YES;
195
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
196
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
197
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
198
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
199
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
200
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
201
+ CLANG_WARN_UNREACHABLE_CODE = YES;
202
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
203
+ COPY_PHASE_STRIP = YES;
204
+ ENABLE_NS_ASSERTIONS = NO;
205
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
206
+ "EXCLUDED_ARCHS[sdk=*]" = arm64;
207
+ GCC_C_LANGUAGE_STANDARD = gnu99;
208
+ GCC_NO_COMMON_BLOCKS = YES;
209
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
210
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
211
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
212
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
213
+ GCC_WARN_UNUSED_FUNCTION = YES;
214
+ GCC_WARN_UNUSED_VARIABLE = YES;
215
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
216
+ MTL_ENABLE_DEBUG_INFO = NO;
217
+ SDKROOT = iphoneos;
218
+ VALIDATE_PRODUCT = YES;
219
+ };
220
+ name = Release;
221
+ };
222
+ 58B511F01A9E6C8500147676 /* Debug */ = {
223
+ isa = XCBuildConfiguration;
224
+ buildSettings = {
225
+ HEADER_SEARCH_PATHS = (
226
+ "$(inherited)",
227
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
228
+ "$(SRCROOT)/../../../React/**",
229
+ "$(SRCROOT)/../../react-native/React/**",
230
+ );
231
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
232
+ OTHER_LDFLAGS = "-ObjC";
233
+ PRODUCT_NAME = UnitReactNativeComponents;
234
+ SKIP_INSTALL = YES;
235
+ SWIFT_OBJC_BRIDGING_HEADER = "UnitReactNativeComponents-Bridging-Header.h";
236
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
237
+ SWIFT_VERSION = 5.0;
238
+ };
239
+ name = Debug;
240
+ };
241
+ 58B511F11A9E6C8500147676 /* Release */ = {
242
+ isa = XCBuildConfiguration;
243
+ buildSettings = {
244
+ HEADER_SEARCH_PATHS = (
245
+ "$(inherited)",
246
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
247
+ "$(SRCROOT)/../../../React/**",
248
+ "$(SRCROOT)/../../react-native/React/**",
249
+ );
250
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
251
+ OTHER_LDFLAGS = "-ObjC";
252
+ PRODUCT_NAME = UnitReactNativeComponents;
253
+ SKIP_INSTALL = YES;
254
+ SWIFT_OBJC_BRIDGING_HEADER = "UnitReactNativeComponents-Bridging-Header.h";
255
+ SWIFT_VERSION = 5.0;
256
+ };
257
+ name = Release;
258
+ };
259
+ /* End XCBuildConfiguration section */
260
+
261
+ /* Begin XCConfigurationList section */
262
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "UnitReactNativeComponents" */ = {
263
+ isa = XCConfigurationList;
264
+ buildConfigurations = (
265
+ 58B511ED1A9E6C8500147676 /* Debug */,
266
+ 58B511EE1A9E6C8500147676 /* Release */,
267
+ );
268
+ defaultConfigurationIsVisible = 0;
269
+ defaultConfigurationName = Release;
270
+ };
271
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "UnitReactNativeComponents" */ = {
272
+ isa = XCConfigurationList;
273
+ buildConfigurations = (
274
+ 58B511F01A9E6C8500147676 /* Debug */,
275
+ 58B511F11A9E6C8500147676 /* Release */,
276
+ );
277
+ defaultConfigurationIsVisible = 0;
278
+ defaultConfigurationName = Release;
279
+ };
280
+ /* End XCConfigurationList section */
281
+ };
282
+ rootObject = 58B511D31A9E6C8500147676 /* Project object */;
283
+ }
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>UnitReactNativeComponents.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -0,0 +1,7 @@
1
+ #import <React/RCTViewManager.h>
2
+
3
+ @interface RCT_EXTERN_MODULE(UnitReactNativeComponentsViewManager, RCTViewManager)
4
+
5
+ RCT_EXPORT_VIEW_PROPERTY(color, NSString)
6
+
7
+ @end
@@ -0,0 +1,36 @@
1
+ @objc(UnitReactNativeComponentsViewManager)
2
+ class UnitReactNativeComponentsViewManager: RCTViewManager {
3
+
4
+ override func view() -> (UnitReactNativeComponentsView) {
5
+ return UnitReactNativeComponentsView()
6
+ }
7
+
8
+ @objc override static func requiresMainQueueSetup() -> Bool {
9
+ return false
10
+ }
11
+ }
12
+
13
+ class UnitReactNativeComponentsView : UIView {
14
+
15
+ @objc var color: String = "" {
16
+ didSet {
17
+ self.backgroundColor = hexStringToUIColor(hexColor: color)
18
+ }
19
+ }
20
+
21
+ func hexStringToUIColor(hexColor: String) -> UIColor {
22
+ let stringScanner = Scanner(string: hexColor)
23
+
24
+ if(hexColor.hasPrefix("#")) {
25
+ stringScanner.scanLocation = 1
26
+ }
27
+ var color: UInt32 = 0
28
+ stringScanner.scanHexInt32(&color)
29
+
30
+ let r = CGFloat(Int(color >> 16) & 0x000000FF)
31
+ let g = CGFloat(Int(color >> 8) & 0x000000FF)
32
+ let b = CGFloat(Int(color) & 0x000000FF)
33
+
34
+ return UIColor(red: r / 255.0, green: g / 255.0, blue: b / 255.0, alpha: 1)
35
+ }
36
+ }