react-native-mehery-event-sender 0.0.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 +20 -0
- package/MeheryEventSender.podspec +25 -0
- package/README.md +33 -0
- package/android/build.gradle +81 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/meheryeventsender/MeheryEventSenderPackage.kt +17 -0
- package/android/src/main/java/com/meheryeventsender/MeheryEventSenderViewManager.kt +20 -0
- package/ios/MeheryEventSenderViewManager.m +34 -0
- package/lib/module/index.js +25 -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/index.d.ts +13 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +156 -0
- package/src/index.tsx +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Neil Carnac
|
|
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.
|
|
@@ -0,0 +1,25 @@
|
|
|
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 = "MeheryEventSender"
|
|
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/neilcarnac/react-native-mehery-event-sender.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm}"
|
|
17
|
+
|
|
18
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
19
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
20
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
21
|
+
install_modules_dependencies(s)
|
|
22
|
+
else
|
|
23
|
+
s.dependency "React-Core"
|
|
24
|
+
end
|
|
25
|
+
end
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# react-native-mehery-event-sender
|
|
2
|
+
|
|
3
|
+
A React Native SDK for event tracking that works with both Expo Go and bare React Native applications
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install react-native-mehery-event-sender
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import { MeheryEventSenderView } from "react-native-mehery-event-sender";
|
|
16
|
+
|
|
17
|
+
// ...
|
|
18
|
+
|
|
19
|
+
<MeheryEventSenderView color="tomato" />
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Contributing
|
|
24
|
+
|
|
25
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
MIT
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['MeheryEventSender_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
+
// noinspection DifferentKotlinGradleVersion
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
apply plugin: "com.android.library"
|
|
20
|
+
apply plugin: "kotlin-android"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def getExtOrIntegerDefault(name) {
|
|
24
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["MeheryEventSender_" + name]).toInteger()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
def supportsNamespace() {
|
|
28
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
29
|
+
def major = parsed[0].toInteger()
|
|
30
|
+
def minor = parsed[1].toInteger()
|
|
31
|
+
|
|
32
|
+
// Namespace support was added in 7.3.0
|
|
33
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
android {
|
|
37
|
+
if (supportsNamespace()) {
|
|
38
|
+
namespace "com.meheryeventsender"
|
|
39
|
+
|
|
40
|
+
sourceSets {
|
|
41
|
+
main {
|
|
42
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
48
|
+
|
|
49
|
+
defaultConfig {
|
|
50
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
51
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
buildTypes {
|
|
55
|
+
release {
|
|
56
|
+
minifyEnabled false
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
lintOptions {
|
|
61
|
+
disable "GradleCompatible"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
compileOptions {
|
|
65
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
66
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
repositories {
|
|
71
|
+
mavenCentral()
|
|
72
|
+
google()
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
76
|
+
|
|
77
|
+
dependencies {
|
|
78
|
+
implementation "com.facebook.react:react-android"
|
|
79
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
80
|
+
}
|
|
81
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.meheryeventsender
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MeheryEventSenderPackage : ReactPackage {
|
|
10
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
11
|
+
return emptyList()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
15
|
+
return listOf(MeheryEventSenderViewManager())
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package com.meheryeventsender
|
|
2
|
+
|
|
3
|
+
import android.graphics.Color
|
|
4
|
+
import android.view.View
|
|
5
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
6
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
7
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
8
|
+
|
|
9
|
+
class MeheryEventSenderViewManager : SimpleViewManager<View>() {
|
|
10
|
+
override fun getName() = "MeheryEventSenderView"
|
|
11
|
+
|
|
12
|
+
override fun createViewInstance(reactContext: ThemedReactContext): View {
|
|
13
|
+
return View(reactContext)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@ReactProp(name = "color")
|
|
17
|
+
fun setColor(view: View, color: String) {
|
|
18
|
+
view.setBackgroundColor(Color.parseColor(color))
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#import <React/RCTViewManager.h>
|
|
2
|
+
|
|
3
|
+
@interface MeheryEventSenderViewManager : RCTViewManager
|
|
4
|
+
@end
|
|
5
|
+
|
|
6
|
+
@implementation MeheryEventSenderViewManager
|
|
7
|
+
|
|
8
|
+
RCT_EXPORT_MODULE(MeheryEventSenderView)
|
|
9
|
+
|
|
10
|
+
- (UIView *)view
|
|
11
|
+
{
|
|
12
|
+
return [[UIView alloc] init];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
RCT_CUSTOM_VIEW_PROPERTY(color, NSString, UIView)
|
|
16
|
+
{
|
|
17
|
+
[view setBackgroundColor:[self hexStringToColor:json]];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
- hexStringToColor:(NSString *)stringToConvert
|
|
21
|
+
{
|
|
22
|
+
NSString *noHashString = [stringToConvert stringByReplacingOccurrencesOfString:@"#" withString:@""];
|
|
23
|
+
NSScanner *stringScanner = [NSScanner scannerWithString:noHashString];
|
|
24
|
+
|
|
25
|
+
unsigned hex;
|
|
26
|
+
if (![stringScanner scanHexInt:&hex]) return nil;
|
|
27
|
+
int r = (hex >> 16) & 0xFF;
|
|
28
|
+
int g = (hex >> 8) & 0xFF;
|
|
29
|
+
int b = (hex) & 0xFF;
|
|
30
|
+
|
|
31
|
+
return [UIColor colorWithRed:r / 255.0f green:g / 255.0f blue:b / 255.0f alpha:1.0f];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { requireNativeComponent, UIManager, Platform } from 'react-native';
|
|
4
|
+
const LINKING_ERROR = `The package 'react-native-mehery-event-sender' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
5
|
+
ios: "- You have run 'pod install'\n",
|
|
6
|
+
default: ''
|
|
7
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
8
|
+
const ComponentName = 'MeheryEventSenderView';
|
|
9
|
+
export const MeheryEventSenderView = UIManager.getViewManagerConfig(ComponentName) != null ? requireNativeComponent(ComponentName) : () => {
|
|
10
|
+
throw new Error(LINKING_ERROR);
|
|
11
|
+
};
|
|
12
|
+
let storedUserDetails = null;
|
|
13
|
+
export function logUserDetails(details) {
|
|
14
|
+
console.log('User Details:');
|
|
15
|
+
Object.entries(details).forEach(([key, value]) => {
|
|
16
|
+
console.log(`${key}: ${value}`);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// Save it internally
|
|
20
|
+
storedUserDetails = details;
|
|
21
|
+
}
|
|
22
|
+
export function getLoggedUserDetails() {
|
|
23
|
+
return storedUserDetails;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["requireNativeComponent","UIManager","Platform","LINKING_ERROR","select","ios","default","ComponentName","MeheryEventSenderView","getViewManagerConfig","Error","storedUserDetails","logUserDetails","details","console","log","Object","entries","forEach","key","value","getLoggedUserDetails"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,SAAS,EACTC,QAAQ,QAEH,cAAc;AAErB,MAAMC,aAAa,GACjB,2FAA2F,GAC3FD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAOjC,MAAMC,aAAa,GAAG,uBAAuB;AAE7C,OAAO,MAAMC,qBAAqB,GAChCP,SAAS,CAACQ,oBAAoB,CAACF,aAAa,CAAC,IAAI,IAAI,GACjDP,sBAAsB,CAAyBO,aAAa,CAAC,GAC7D,MAAM;EACJ,MAAM,IAAIG,KAAK,CAACP,aAAa,CAAC;AAChC,CAAC;AAKP,IAAIQ,iBAAqC,GAAG,IAAI;AAEhD,OAAO,SAASC,cAAcA,CAACC,OAAoB,EAAE;EACnDC,OAAO,CAACC,GAAG,CAAC,eAAe,CAAC;EAC5BC,MAAM,CAACC,OAAO,CAACJ,OAAO,CAAC,CAACK,OAAO,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;IAChDN,OAAO,CAACC,GAAG,CAAC,GAAGI,GAAG,KAAKC,KAAK,EAAE,CAAC;EACjC,CAAC,CAAC;;EAEF;EACAT,iBAAiB,GAAGE,OAAO;AAC7B;AAEA,OAAO,SAASQ,oBAAoBA,CAAA,EAAuB;EACzD,OAAOV,iBAAiB;AAC1B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ViewStyle } from 'react-native';
|
|
2
|
+
type MeheryEventSenderProps = {
|
|
3
|
+
color: string;
|
|
4
|
+
style: ViewStyle;
|
|
5
|
+
};
|
|
6
|
+
export declare const MeheryEventSenderView: import("react-native").HostComponent<MeheryEventSenderProps> | (() => never);
|
|
7
|
+
type UserDetails = {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function logUserDetails(details: UserDetails): void;
|
|
11
|
+
export declare function getLoggedUserDetails(): UserDetails | null;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAQtB,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC;AAIF,eAAO,MAAM,qBAAqB,8EAK3B,CAAC;AAER,KAAK,WAAW,GAAG;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CAAC;AAGF,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,QAQlD;AAED,wBAAgB,oBAAoB,IAAI,WAAW,GAAG,IAAI,CAEzD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-mehery-event-sender",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A React Native SDK for event tracking that works with both Expo Go and bare React Native applications",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/module/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
10
|
+
"default": "./lib/module/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"src",
|
|
16
|
+
"lib",
|
|
17
|
+
"android",
|
|
18
|
+
"ios",
|
|
19
|
+
"cpp",
|
|
20
|
+
"*.podspec",
|
|
21
|
+
"react-native.config.js",
|
|
22
|
+
"!ios/build",
|
|
23
|
+
"!android/build",
|
|
24
|
+
"!android/gradle",
|
|
25
|
+
"!android/gradlew",
|
|
26
|
+
"!android/gradlew.bat",
|
|
27
|
+
"!android/local.properties",
|
|
28
|
+
"!**/__tests__",
|
|
29
|
+
"!**/__fixtures__",
|
|
30
|
+
"!**/__mocks__",
|
|
31
|
+
"!**/.*"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"example": "yarn workspace react-native-mehery-event-sender-example",
|
|
35
|
+
"test": "jest",
|
|
36
|
+
"typecheck": "tsc",
|
|
37
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
38
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
39
|
+
"prepare": "bob build",
|
|
40
|
+
"release": "release-it"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"react-native",
|
|
44
|
+
"ios",
|
|
45
|
+
"android"
|
|
46
|
+
],
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/neilcarnac/react-native-mehery-event-sender.git"
|
|
50
|
+
},
|
|
51
|
+
"author": "Neil Carnac <ncarnac@gmail.com> (https://github.com/neilcarnac)",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/neilcarnac/react-native-mehery-event-sender/issues"
|
|
55
|
+
},
|
|
56
|
+
"homepage": "https://github.com/neilcarnac/react-native-mehery-event-sender#readme",
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"registry": "https://registry.npmjs.org/"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
62
|
+
"@eslint/compat": "^1.2.7",
|
|
63
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
64
|
+
"@eslint/js": "^9.22.0",
|
|
65
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
66
|
+
"@react-native/eslint-config": "^0.78.0",
|
|
67
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
68
|
+
"@types/jest": "^29.5.5",
|
|
69
|
+
"@types/react": "^19.1.0",
|
|
70
|
+
"commitlint": "^19.6.1",
|
|
71
|
+
"del-cli": "^5.1.0",
|
|
72
|
+
"eslint": "^9.22.0",
|
|
73
|
+
"eslint-config-prettier": "^10.1.1",
|
|
74
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
75
|
+
"expo-notifications": "^0.31.3",
|
|
76
|
+
"jest": "^29.7.0",
|
|
77
|
+
"prettier": "^3.0.3",
|
|
78
|
+
"react": "19.1.0",
|
|
79
|
+
"react-native": "0.80.0",
|
|
80
|
+
"react-native-builder-bob": "^0.38.3",
|
|
81
|
+
"release-it": "^17.10.0",
|
|
82
|
+
"turbo": "^1.10.7",
|
|
83
|
+
"typescript": "^5.2.2"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"expo-notifications": "^0.20.0",
|
|
87
|
+
"react": "*",
|
|
88
|
+
"react-native": "*",
|
|
89
|
+
"react-native-push-notification": "^8.1.1"
|
|
90
|
+
},
|
|
91
|
+
"workspaces": [
|
|
92
|
+
"example"
|
|
93
|
+
],
|
|
94
|
+
"packageManager": "yarn@3.6.1",
|
|
95
|
+
"jest": {
|
|
96
|
+
"preset": "react-native",
|
|
97
|
+
"modulePathIgnorePatterns": [
|
|
98
|
+
"<rootDir>/example/node_modules",
|
|
99
|
+
"<rootDir>/lib/"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"commitlint": {
|
|
103
|
+
"extends": [
|
|
104
|
+
"@commitlint/config-conventional"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
"release-it": {
|
|
108
|
+
"git": {
|
|
109
|
+
"commitMessage": "chore: release ${version}",
|
|
110
|
+
"tagName": "v${version}"
|
|
111
|
+
},
|
|
112
|
+
"npm": {
|
|
113
|
+
"publish": true
|
|
114
|
+
},
|
|
115
|
+
"github": {
|
|
116
|
+
"release": true
|
|
117
|
+
},
|
|
118
|
+
"plugins": {
|
|
119
|
+
"@release-it/conventional-changelog": {
|
|
120
|
+
"preset": {
|
|
121
|
+
"name": "angular"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"prettier": {
|
|
127
|
+
"quoteProps": "consistent",
|
|
128
|
+
"singleQuote": true,
|
|
129
|
+
"tabWidth": 2,
|
|
130
|
+
"trailingComma": "es5",
|
|
131
|
+
"useTabs": false
|
|
132
|
+
},
|
|
133
|
+
"react-native-builder-bob": {
|
|
134
|
+
"source": "src",
|
|
135
|
+
"output": "lib",
|
|
136
|
+
"targets": [
|
|
137
|
+
[
|
|
138
|
+
"module",
|
|
139
|
+
{
|
|
140
|
+
"esm": true
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
[
|
|
144
|
+
"typescript",
|
|
145
|
+
{
|
|
146
|
+
"project": "tsconfig.build.json"
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
"create-react-native-library": {
|
|
152
|
+
"type": "legacy-view",
|
|
153
|
+
"languages": "kotlin-objc",
|
|
154
|
+
"version": "0.49.2"
|
|
155
|
+
}
|
|
156
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
requireNativeComponent,
|
|
3
|
+
UIManager,
|
|
4
|
+
Platform,
|
|
5
|
+
type ViewStyle,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
const LINKING_ERROR =
|
|
9
|
+
`The package 'react-native-mehery-event-sender' doesn't seem to be linked. Make sure: \n\n` +
|
|
10
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
11
|
+
'- You rebuilt the app after installing the package\n' +
|
|
12
|
+
'- You are not using Expo Go\n';
|
|
13
|
+
|
|
14
|
+
type MeheryEventSenderProps = {
|
|
15
|
+
color: string;
|
|
16
|
+
style: ViewStyle;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const ComponentName = 'MeheryEventSenderView';
|
|
20
|
+
|
|
21
|
+
export const MeheryEventSenderView =
|
|
22
|
+
UIManager.getViewManagerConfig(ComponentName) != null
|
|
23
|
+
? requireNativeComponent<MeheryEventSenderProps>(ComponentName)
|
|
24
|
+
: () => {
|
|
25
|
+
throw new Error(LINKING_ERROR);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type UserDetails = {
|
|
29
|
+
[key: string]: string;
|
|
30
|
+
};
|
|
31
|
+
let storedUserDetails: UserDetails | null = null;
|
|
32
|
+
|
|
33
|
+
export function logUserDetails(details: UserDetails) {
|
|
34
|
+
console.log('User Details:');
|
|
35
|
+
Object.entries(details).forEach(([key, value]) => {
|
|
36
|
+
console.log(`${key}: ${value}`);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Save it internally
|
|
40
|
+
storedUserDetails = details;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getLoggedUserDetails(): UserDetails | null {
|
|
44
|
+
return storedUserDetails;
|
|
45
|
+
}
|