react-native-tinykit 0.1.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 ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Darkce
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,89 @@
1
+ # react-native-tinykit
2
+
3
+ [![npm version](https://img.shields.io/npm/v/react-native-tinykit.svg)](https://www.npmjs.com/package/react-native-tinykit)
4
+ [![license](https://img.shields.io/npm/l/react-native-tinykit.svg)](https://github.com/luoxuhai/react-native-tinykit/blob/master/LICENSE)
5
+
6
+ A lightweight React Native toolkit for iOS, providing essential native utilities.
7
+
8
+ ## Features
9
+
10
+ - 🔄 **App Restart** - Programmatically restart your React Native application
11
+ - âš¡ **Turbo Module** - Built with the new architecture for optimal performance
12
+ - 📦 **Lightweight** - Minimal footprint with zero dependencies
13
+
14
+ ## Requirements
15
+
16
+ - React Native >= 0.76
17
+ - iOS only (for now)
18
+
19
+ ## Installation
20
+
21
+ ```sh
22
+ # Using npm
23
+ npm install react-native-tinykit
24
+
25
+ # Using yarn
26
+ yarn add react-native-tinykit
27
+ ```
28
+
29
+ ### iOS Setup
30
+
31
+ ```sh
32
+ cd ios && pod install
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ### Restart Application
38
+
39
+ Restart the React Native application programmatically:
40
+
41
+ ```tsx
42
+ import { restart } from 'react-native-tinykit';
43
+
44
+ // Restart the app
45
+ restart();
46
+ ```
47
+
48
+ #### Example Use Cases
49
+
50
+ - Force reload after language/locale change
51
+ - Reset app state after logout
52
+ - Apply configuration changes that require a restart
53
+
54
+ ## API Reference
55
+
56
+ ### `restart()`
57
+
58
+ Triggers a reload of the React Native application.
59
+
60
+ ```tsx
61
+ restart(): void
62
+ ```
63
+
64
+ **Example:**
65
+
66
+ ```tsx
67
+ import { restart } from 'react-native-tinykit';
68
+
69
+ const handleLogout = async () => {
70
+ await clearUserData();
71
+ restart(); // Restart app to reset state
72
+ };
73
+ ```
74
+
75
+ ## Contributing
76
+
77
+ See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
78
+
79
+ - [Development workflow](CONTRIBUTING.md#development-workflow)
80
+ - [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
81
+ - [Code of conduct](CODE_OF_CONDUCT.md)
82
+
83
+ ## License
84
+
85
+ MIT © [Darkce](https://github.com/luoxuhai)
86
+
87
+ ---
88
+
89
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -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 = "Tinykit"
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/luoxuhai/react-native-tinykit.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/ios/Tinykit.h ADDED
@@ -0,0 +1,5 @@
1
+ #import <TinykitSpec/TinykitSpec.h>
2
+
3
+ @interface Tinykit : NSObject <NativeTinykitSpec>
4
+
5
+ @end
package/ios/Tinykit.mm ADDED
@@ -0,0 +1,23 @@
1
+ #import "Tinykit.h"
2
+ #import <React/RCTReloadCommand.h>
3
+
4
+ @implementation Tinykit
5
+
6
+ - (void)restart {
7
+ dispatch_sync(dispatch_get_main_queue(), ^{
8
+ RCTTriggerReloadCommandListeners(@"react-native-tinykit");
9
+ });
10
+ }
11
+
12
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
13
+ (const facebook::react::ObjCTurboModule::InitParams &)params
14
+ {
15
+ return std::make_shared<facebook::react::NativeTinykitSpecJSI>(params);
16
+ }
17
+
18
+ + (NSString *)moduleName
19
+ {
20
+ return @"Tinykit";
21
+ }
22
+
23
+ @end
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+ export default TurboModuleRegistry.getEnforcing('Tinykit');
5
+ //# sourceMappingURL=NativeTinykit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeTinykit.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AAMpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,SAAS,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ import Tinykit from "./NativeTinykit.js";
4
+
5
+ /**
6
+ * Restarts the React Native application.
7
+ */
8
+ export function restart() {
9
+ return Tinykit.restart();
10
+ }
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Tinykit","restart"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,OAAO,MAAM,oBAAiB;;AAErC;AACA;AACA;AACA,OAAO,SAASC,OAAOA,CAAA,EAAS;EAC9B,OAAOD,OAAO,CAACC,OAAO,CAAC,CAAC;AAC1B","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,7 @@
1
+ import { type TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ restart(): void;
4
+ }
5
+ declare const _default: Spec;
6
+ export default _default;
7
+ //# sourceMappingURL=NativeTinykit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeTinykit.d.ts","sourceRoot":"","sources":["../../../src/NativeTinykit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,OAAO,IAAI,IAAI,CAAC;CACjB;;AAED,wBAAiE"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Restarts the React Native application.
3
+ */
4
+ export declare function restart(): void;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAE9B"}
package/package.json ADDED
@@ -0,0 +1,149 @@
1
+ {
2
+ "name": "react-native-tinykit",
3
+ "version": "0.1.1",
4
+ "description": "react native tiny kit for ios",
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-tinykit-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
+ "release": "release-it --only-version"
41
+ },
42
+ "keywords": [
43
+ "react-native",
44
+ "ios",
45
+ "android"
46
+ ],
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/luoxuhai/react-native-tinykit.git"
50
+ },
51
+ "author": "Darkce <darkce97@gmail.com> (https://github.com/luoxuhai)",
52
+ "license": "MIT",
53
+ "bugs": {
54
+ "url": "https://github.com/luoxuhai/react-native-tinykit/issues"
55
+ },
56
+ "homepage": "https://github.com/luoxuhai/react-native-tinykit#readme",
57
+ "publishConfig": {
58
+ "registry": "https://registry.npmjs.org/"
59
+ },
60
+ "devDependencies": {
61
+ "@eslint/compat": "^1.3.2",
62
+ "@eslint/eslintrc": "^3.3.1",
63
+ "@eslint/js": "^9.35.0",
64
+ "@react-native/babel-preset": "0.83.0",
65
+ "@react-native/eslint-config": "0.83.0",
66
+ "@release-it/conventional-changelog": "^10.0.1",
67
+ "@types/react": "^19.2.0",
68
+ "del-cli": "^6.0.0",
69
+ "eslint": "^9.35.0",
70
+ "eslint-config-prettier": "^10.1.8",
71
+ "eslint-plugin-prettier": "^5.5.4",
72
+ "prettier": "^2.8.8",
73
+ "react": "19.2.0",
74
+ "react-native": "0.83.0",
75
+ "react-native-builder-bob": "^0.40.17",
76
+ "release-it": "^19.0.4",
77
+ "turbo": "^2.5.6",
78
+ "typescript": "^5.9.2"
79
+ },
80
+ "peerDependencies": {
81
+ "react": "*",
82
+ "react-native": "*"
83
+ },
84
+ "workspaces": [
85
+ "example"
86
+ ],
87
+ "packageManager": "yarn@4.11.0",
88
+ "react-native-builder-bob": {
89
+ "source": "src",
90
+ "output": "lib",
91
+ "targets": [
92
+ [
93
+ "module",
94
+ {
95
+ "esm": true
96
+ }
97
+ ],
98
+ [
99
+ "typescript",
100
+ {
101
+ "project": "tsconfig.build.json"
102
+ }
103
+ ]
104
+ ]
105
+ },
106
+ "codegenConfig": {
107
+ "name": "TinykitSpec",
108
+ "type": "modules",
109
+ "jsSrcsDir": "src",
110
+ "android": {
111
+ "javaPackageName": "com.tinykit"
112
+ }
113
+ },
114
+ "prettier": {
115
+ "quoteProps": "consistent",
116
+ "singleQuote": true,
117
+ "tabWidth": 2,
118
+ "trailingComma": "es5",
119
+ "useTabs": false
120
+ },
121
+ "release-it": {
122
+ "git": {
123
+ "commitMessage": "chore: release ${version}",
124
+ "tagName": "v${version}"
125
+ },
126
+ "npm": {
127
+ "publish": true
128
+ },
129
+ "github": {
130
+ "release": true
131
+ },
132
+ "plugins": {
133
+ "@release-it/conventional-changelog": {
134
+ "preset": {
135
+ "name": "angular"
136
+ }
137
+ }
138
+ }
139
+ },
140
+ "create-react-native-library": {
141
+ "type": "turbo-module",
142
+ "languages": "kotlin-objc",
143
+ "tools": [
144
+ "eslint",
145
+ "release-it"
146
+ ],
147
+ "version": "0.56.0"
148
+ }
149
+ }
@@ -0,0 +1,7 @@
1
+ import { TurboModuleRegistry, type TurboModule } from 'react-native';
2
+
3
+ export interface Spec extends TurboModule {
4
+ restart(): void;
5
+ }
6
+
7
+ export default TurboModuleRegistry.getEnforcing<Spec>('Tinykit');
package/src/index.tsx ADDED
@@ -0,0 +1,8 @@
1
+ import Tinykit from './NativeTinykit';
2
+
3
+ /**
4
+ * Restarts the React Native application.
5
+ */
6
+ export function restart(): void {
7
+ return Tinykit.restart();
8
+ }