react-native-fabric-declarative 0.2.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/FabricDeclarative.podspec +20 -0
- package/LICENSE +20 -0
- package/README.md +37 -0
- package/android/build.gradle +67 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/fabricdeclarative/FabricDeclarativePackage.kt +17 -0
- package/android/src/main/java/com/fabricdeclarative/FabricDeclarativeView.kt +15 -0
- package/android/src/main/java/com/fabricdeclarative/FabricDeclarativeViewManager.kt +41 -0
- package/ios/FabricDeclarativeView.h +14 -0
- package/ios/FabricDeclarativeView.mm +105 -0
- package/lib/module/FabricDeclarativeViewNativeComponent.ts +22 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/FabricDeclarativeViewNativeComponent.d.ts +18 -0
- package/lib/typescript/src/FabricDeclarativeViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +176 -0
- package/src/FabricDeclarativeViewNativeComponent.ts +22 -0
- package/src/index.tsx +2 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "FabricDeclarative"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://github.com/VladOch/react-native-fabric-declarative.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
|
|
17
|
+
s.private_header_files = "ios/**/*.h"
|
|
18
|
+
|
|
19
|
+
install_modules_dependencies(s)
|
|
20
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vlad.ocheretnyi322
|
|
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,37 @@
|
|
|
1
|
+
# react-native-fabric-declarative
|
|
2
|
+
|
|
3
|
+
react-native-fabric-declarativefabric-declarative
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install react-native-fabric-declarative
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import { FabricDeclarativeView } from "react-native-fabric-declarative";
|
|
18
|
+
|
|
19
|
+
// ...
|
|
20
|
+
|
|
21
|
+
<FabricDeclarativeView color="tomato" />
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Contributing
|
|
26
|
+
|
|
27
|
+
- [Development workflow](CONTRIBUTING.md#development-workflow)
|
|
28
|
+
- [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
|
|
29
|
+
- [Code of conduct](CODE_OF_CONDUCT.md)
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.FabricDeclarative = [
|
|
3
|
+
kotlinVersion: "2.0.21",
|
|
4
|
+
minSdkVersion: 24,
|
|
5
|
+
compileSdkVersion: 36,
|
|
6
|
+
targetSdkVersion: 36
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
ext.getExtOrDefault = { prop ->
|
|
10
|
+
if (rootProject.ext.has(prop)) {
|
|
11
|
+
return rootProject.ext.get(prop)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return FabricDeclarative[prop]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
repositories {
|
|
18
|
+
google()
|
|
19
|
+
mavenCentral()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
dependencies {
|
|
23
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
24
|
+
// noinspection DifferentKotlinGradleVersion
|
|
25
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
apply plugin: "com.android.library"
|
|
31
|
+
apply plugin: "kotlin-android"
|
|
32
|
+
|
|
33
|
+
apply plugin: "com.facebook.react"
|
|
34
|
+
|
|
35
|
+
android {
|
|
36
|
+
namespace "com.fabricdeclarative"
|
|
37
|
+
|
|
38
|
+
compileSdkVersion getExtOrDefault("compileSdkVersion")
|
|
39
|
+
|
|
40
|
+
defaultConfig {
|
|
41
|
+
minSdkVersion getExtOrDefault("minSdkVersion")
|
|
42
|
+
targetSdkVersion getExtOrDefault("targetSdkVersion")
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
buildFeatures {
|
|
46
|
+
buildConfig true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
buildTypes {
|
|
50
|
+
release {
|
|
51
|
+
minifyEnabled false
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
lint {
|
|
56
|
+
disable "GradleCompatible"
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
compileOptions {
|
|
60
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
61
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
dependencies {
|
|
66
|
+
implementation "com.facebook.react:react-android"
|
|
67
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.fabricdeclarative
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
7
|
+
import com.facebook.react.uimanager.ViewManager
|
|
8
|
+
|
|
9
|
+
class FabricDeclarativeViewPackage : BaseReactPackage() {
|
|
10
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
11
|
+
return listOf(FabricDeclarativeViewManager())
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? = null
|
|
15
|
+
|
|
16
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider { emptyMap() }
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package com.fabricdeclarative
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.util.AttributeSet
|
|
5
|
+
import android.view.View
|
|
6
|
+
|
|
7
|
+
class FabricDeclarativeView : View {
|
|
8
|
+
constructor(context: Context?) : super(context)
|
|
9
|
+
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
|
|
10
|
+
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
|
|
11
|
+
context,
|
|
12
|
+
attrs,
|
|
13
|
+
defStyleAttr
|
|
14
|
+
)
|
|
15
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
package com.fabricdeclarative
|
|
2
|
+
|
|
3
|
+
import android.graphics.Color
|
|
4
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
5
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
6
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
7
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
8
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
9
|
+
import com.facebook.react.viewmanagers.FabricDeclarativeViewManagerInterface
|
|
10
|
+
import com.facebook.react.viewmanagers.FabricDeclarativeViewManagerDelegate
|
|
11
|
+
|
|
12
|
+
@ReactModule(name = FabricDeclarativeViewManager.NAME)
|
|
13
|
+
class FabricDeclarativeViewManager : SimpleViewManager<FabricDeclarativeView>(),
|
|
14
|
+
FabricDeclarativeViewManagerInterface<FabricDeclarativeView> {
|
|
15
|
+
private val mDelegate: ViewManagerDelegate<FabricDeclarativeView>
|
|
16
|
+
|
|
17
|
+
init {
|
|
18
|
+
mDelegate = FabricDeclarativeViewManagerDelegate(this)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override fun getDelegate(): ViewManagerDelegate<FabricDeclarativeView>? {
|
|
22
|
+
return mDelegate
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override fun getName(): String {
|
|
26
|
+
return NAME
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public override fun createViewInstance(context: ThemedReactContext): FabricDeclarativeView {
|
|
30
|
+
return FabricDeclarativeView(context)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@ReactProp(name = "color")
|
|
34
|
+
override fun setColor(view: FabricDeclarativeView?, color: Int?) {
|
|
35
|
+
view?.setBackgroundColor(color ?: Color.TRANSPARENT)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
companion object {
|
|
39
|
+
const val NAME = "FabricDeclarativeView"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#import <React/RCTViewComponentView.h>
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
3
|
+
|
|
4
|
+
#ifndef FabricDeclarativeViewNativeComponent_h
|
|
5
|
+
#define FabricDeclarativeViewNativeComponent_h
|
|
6
|
+
|
|
7
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
8
|
+
|
|
9
|
+
@interface FabricDeclarativeView : RCTViewComponentView
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_END
|
|
13
|
+
|
|
14
|
+
#endif /* FabricDeclarativeViewNativeComponent_h */
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#import "FabricDeclarativeView.h"
|
|
2
|
+
|
|
3
|
+
#import <React/RCTConversions.h>
|
|
4
|
+
|
|
5
|
+
#import <react/renderer/components/FabricDeclarativeViewSpec/ComponentDescriptors.h>
|
|
6
|
+
#import <react/renderer/components/FabricDeclarativeViewSpec/Props.h>
|
|
7
|
+
#import <react/renderer/components/FabricDeclarativeViewSpec/RCTComponentViewHelpers.h>
|
|
8
|
+
|
|
9
|
+
#import "RCTFabricComponentsPlugins.h"
|
|
10
|
+
|
|
11
|
+
#if __has_include("FabricDeclarative/FabricDeclarative-Swift.h")
|
|
12
|
+
#import "FabricDeclarative/FabricDeclarative-Swift.h"
|
|
13
|
+
#else
|
|
14
|
+
#import "FabricDeclarative-Swift.h"
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
using namespace facebook::react;
|
|
18
|
+
|
|
19
|
+
@implementation FabricDeclarativeView {
|
|
20
|
+
SwiftUIViewManager* _manager;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
24
|
+
{
|
|
25
|
+
return concreteComponentDescriptorProvider<FabricDeclarativeViewComponentDescriptor>();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
29
|
+
{
|
|
30
|
+
if (self = [super initWithFrame:frame]) {
|
|
31
|
+
static const auto defaultProps = std::make_shared<const FabricDeclarativeViewProps>();
|
|
32
|
+
_props = defaultProps;
|
|
33
|
+
|
|
34
|
+
_manager = [[SwiftUIViewManager alloc] init];
|
|
35
|
+
|
|
36
|
+
self.contentView = [_manager getView];
|
|
37
|
+
|
|
38
|
+
// 5️⃣ 👇 add this | assigning anonymous function to onSubmit property of SwiftUIViewManager instance
|
|
39
|
+
_manager.onSubmit = ^(
|
|
40
|
+
NSString* inputString,double selectedNumber,NSArray<NSNumber*>*restNumbers
|
|
41
|
+
) {
|
|
42
|
+
[self handleSubmit:inputString selectedNumber:selectedNumber restNumbers:restNumbers];
|
|
43
|
+
};
|
|
44
|
+
// 👆add this
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return self;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
52
|
+
{
|
|
53
|
+
const auto &oldViewProps = *std::static_pointer_cast<FabricDeclarativeViewProps const>(_props);
|
|
54
|
+
const auto &newViewProps = *std::static_pointer_cast<FabricDeclarativeViewProps const>(props);
|
|
55
|
+
|
|
56
|
+
if(oldViewProps.title != newViewProps.title) {
|
|
57
|
+
NSString* newTitle = [[NSString alloc] initWithUTF8String: newViewProps.title.c_str()];
|
|
58
|
+
|
|
59
|
+
[_manager updateTitleWithNewTitle:newTitle]; // updating title property
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if(oldViewProps.options != newViewProps.options) {
|
|
63
|
+
NSMutableArray<NSNumber*>* newOptions = [[NSMutableArray alloc] init];
|
|
64
|
+
|
|
65
|
+
// parsing options values to NSMutableArray<NSNumber*>*
|
|
66
|
+
for (double option : newViewProps.options) {
|
|
67
|
+
[newOptions addObject:@(option)];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[_manager updateOptionsWithNewOptions:newOptions]; // updating options
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
[super updateProps:props oldProps:oldProps];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
- (void)handleSubmit:(NSString*)inputString selectedNumber:(double)selectedNumber restNumbers:(NSArray<NSNumber*>*) restNumbers
|
|
78
|
+
{
|
|
79
|
+
if(!_eventEmitter) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 2️⃣ parsing data from array of numbers (NSArray<NSNumber*>*) to vector of double
|
|
84
|
+
std::vector<double> restNumbersVector = {};
|
|
85
|
+
|
|
86
|
+
for (NSNumber* num in restNumbers) {
|
|
87
|
+
restNumbersVector.push_back([num doubleValue]);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// 3️⃣ define data that we pass to the React side
|
|
91
|
+
FabricDeclarativeViewEventEmitter::OnSubmit event = {
|
|
92
|
+
.input = [inputString UTF8String],
|
|
93
|
+
.selectedNumber = selectedNumber,
|
|
94
|
+
.objectResults = {
|
|
95
|
+
.restNumbers = restNumbersVector,
|
|
96
|
+
.uppercaseInput = [[inputString uppercaseString] UTF8String]
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// 4️⃣ dispatching event
|
|
101
|
+
std::dynamic_pointer_cast<const FabricDeclarativeViewEventEmitter>(self->_eventEmitter)->onSubmit(event);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@end
|
|
105
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { codegenNativeComponent, type ViewProps } from 'react-native';
|
|
2
|
+
import type {
|
|
3
|
+
BubblingEventHandler,
|
|
4
|
+
Double,
|
|
5
|
+
} from 'react-native/Libraries/Types/CodegenTypesNamespace';
|
|
6
|
+
|
|
7
|
+
interface SubmitEvent {
|
|
8
|
+
input: string;
|
|
9
|
+
selectedNumber: Double;
|
|
10
|
+
objectResults: {
|
|
11
|
+
restNumbers: Double[];
|
|
12
|
+
uppercaseInput: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface NativeProps extends ViewProps {
|
|
17
|
+
title: string;
|
|
18
|
+
options: Double[];
|
|
19
|
+
onSubmit: BubblingEventHandler<Readonly<SubmitEvent>>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default codegenNativeComponent<NativeProps>('FabricDeclarativeView');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","FabricDeclarativeView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,qBAAqB,QAAQ,wCAAwC;AACzF,cAAc,wCAAwC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ViewProps } from 'react-native';
|
|
2
|
+
import type { BubblingEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypesNamespace';
|
|
3
|
+
interface SubmitEvent {
|
|
4
|
+
input: string;
|
|
5
|
+
selectedNumber: Double;
|
|
6
|
+
objectResults: {
|
|
7
|
+
restNumbers: Double[];
|
|
8
|
+
uppercaseInput: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
interface NativeProps extends ViewProps {
|
|
12
|
+
title: string;
|
|
13
|
+
options: Double[];
|
|
14
|
+
onSubmit: BubblingEventHandler<Readonly<SubmitEvent>>;
|
|
15
|
+
}
|
|
16
|
+
declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
17
|
+
export default _default;
|
|
18
|
+
//# sourceMappingURL=FabricDeclarativeViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FabricDeclarativeViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/FabricDeclarativeViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EACV,oBAAoB,EACpB,MAAM,EACP,MAAM,oDAAoD,CAAC;AAE5D,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;CACvD;;AAED,wBAA4E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC1F,cAAc,wCAAwC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-fabric-declarative",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "react-native-fabric-declarativefabric-declarative",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"react-native.config.js",
|
|
23
|
+
"!ios/build",
|
|
24
|
+
"!android/build",
|
|
25
|
+
"!android/gradle",
|
|
26
|
+
"!android/gradlew",
|
|
27
|
+
"!android/gradlew.bat",
|
|
28
|
+
"!android/local.properties",
|
|
29
|
+
"!**/__tests__",
|
|
30
|
+
"!**/__fixtures__",
|
|
31
|
+
"!**/__mocks__",
|
|
32
|
+
"!**/.*"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"example": "yarn workspace react-native-fabric-declarative-example",
|
|
36
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
37
|
+
"prepare": "bob build",
|
|
38
|
+
"typecheck": "tsc",
|
|
39
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"release": "release-it --only-version"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"react-native",
|
|
45
|
+
"ios",
|
|
46
|
+
"android"
|
|
47
|
+
],
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/VladOch/react-native-fabric-declarative.git"
|
|
51
|
+
},
|
|
52
|
+
"author": "vlad.ocheretnyi322 <vlad.ocheretnyi322@gmail.com> (https://github.com/VladOch)",
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/VladOch/react-native-fabric-declarative/issues"
|
|
56
|
+
},
|
|
57
|
+
"homepage": "https://github.com/VladOch/react-native-fabric-declarative#readme",
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"registry": "https://registry.npmjs.org/"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
63
|
+
"@eslint/compat": "^1.3.2",
|
|
64
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
65
|
+
"@eslint/js": "^9.35.0",
|
|
66
|
+
"@react-native/babel-preset": "0.83.0",
|
|
67
|
+
"@react-native/eslint-config": "0.83.0",
|
|
68
|
+
"@release-it/conventional-changelog": "8.0.2",
|
|
69
|
+
"@types/jest": "^29.5.14",
|
|
70
|
+
"@types/react": "^19.2.0",
|
|
71
|
+
"commitlint": "^19.8.1",
|
|
72
|
+
"del-cli": "^6.0.0",
|
|
73
|
+
"eslint": "^9.35.0",
|
|
74
|
+
"eslint-config-prettier": "^10.1.8",
|
|
75
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
76
|
+
"jest": "^29.7.0",
|
|
77
|
+
"lefthook": "^2.0.3",
|
|
78
|
+
"prettier": "^2.8.8",
|
|
79
|
+
"react": "19.2.0",
|
|
80
|
+
"react-native": "0.83.0",
|
|
81
|
+
"react-native-builder-bob": "^0.40.17",
|
|
82
|
+
"release-it": "^19.0.4",
|
|
83
|
+
"turbo": "^2.5.6",
|
|
84
|
+
"typescript": "^5.9.2"
|
|
85
|
+
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"react": "*",
|
|
88
|
+
"react-native": "*"
|
|
89
|
+
},
|
|
90
|
+
"workspaces": [
|
|
91
|
+
"example"
|
|
92
|
+
],
|
|
93
|
+
"packageManager": "yarn@4.11.0",
|
|
94
|
+
"react-native-builder-bob": {
|
|
95
|
+
"source": "src",
|
|
96
|
+
"output": "lib",
|
|
97
|
+
"targets": [
|
|
98
|
+
[
|
|
99
|
+
"module",
|
|
100
|
+
{
|
|
101
|
+
"esm": true
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
"typescript",
|
|
106
|
+
{
|
|
107
|
+
"project": "tsconfig.build.json"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
"codegenConfig": {
|
|
113
|
+
"name": "FabricDeclarativeViewSpec",
|
|
114
|
+
"type": "all",
|
|
115
|
+
"jsSrcsDir": "src",
|
|
116
|
+
"android": {
|
|
117
|
+
"javaPackageName": "com.fabricdeclarative"
|
|
118
|
+
},
|
|
119
|
+
"ios": {
|
|
120
|
+
"components": {
|
|
121
|
+
"FabricDeclarativeView": {
|
|
122
|
+
"className": "FabricDeclarativeView"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"prettier": {
|
|
128
|
+
"quoteProps": "consistent",
|
|
129
|
+
"singleQuote": true,
|
|
130
|
+
"tabWidth": 2,
|
|
131
|
+
"trailingComma": "es5",
|
|
132
|
+
"useTabs": false
|
|
133
|
+
},
|
|
134
|
+
"jest": {
|
|
135
|
+
"preset": "react-native",
|
|
136
|
+
"modulePathIgnorePatterns": [
|
|
137
|
+
"<rootDir>/example/node_modules",
|
|
138
|
+
"<rootDir>/lib/"
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"commitlint": {
|
|
142
|
+
"extends": [
|
|
143
|
+
"@commitlint/config-conventional"
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
"release-it": {
|
|
147
|
+
"git": {
|
|
148
|
+
"commitMessage": "chore: release ${version}",
|
|
149
|
+
"tagName": "v${version}"
|
|
150
|
+
},
|
|
151
|
+
"npm": {
|
|
152
|
+
"publish": true
|
|
153
|
+
},
|
|
154
|
+
"github": {
|
|
155
|
+
"release": true
|
|
156
|
+
},
|
|
157
|
+
"plugins": {
|
|
158
|
+
"@release-it/conventional-changelog": {
|
|
159
|
+
"preset": {
|
|
160
|
+
"name": "angular"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"create-react-native-library": {
|
|
166
|
+
"type": "fabric-view",
|
|
167
|
+
"languages": "kotlin-objc",
|
|
168
|
+
"tools": [
|
|
169
|
+
"eslint",
|
|
170
|
+
"jest",
|
|
171
|
+
"lefthook",
|
|
172
|
+
"release-it"
|
|
173
|
+
],
|
|
174
|
+
"version": "0.57.0"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { codegenNativeComponent, type ViewProps } from 'react-native';
|
|
2
|
+
import type {
|
|
3
|
+
BubblingEventHandler,
|
|
4
|
+
Double,
|
|
5
|
+
} from 'react-native/Libraries/Types/CodegenTypesNamespace';
|
|
6
|
+
|
|
7
|
+
interface SubmitEvent {
|
|
8
|
+
input: string;
|
|
9
|
+
selectedNumber: Double;
|
|
10
|
+
objectResults: {
|
|
11
|
+
restNumbers: Double[];
|
|
12
|
+
uppercaseInput: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface NativeProps extends ViewProps {
|
|
17
|
+
title: string;
|
|
18
|
+
options: Double[];
|
|
19
|
+
onSubmit: BubblingEventHandler<Readonly<SubmitEvent>>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default codegenNativeComponent<NativeProps>('FabricDeclarativeView');
|
package/src/index.tsx
ADDED