expo-module-template 10.7.13 → 10.7.15
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/$.gitignore +57 -0
- package/$.npmignore +11 -0
- package/$package.json +5 -4
- package/android/build.gradle +2 -2
- package/android/src/main/java/{%= project.package %}/{{%- project.name %}Module.kt → {%- project.moduleName %}.kt } +3 -3
- package/android/src/main/java/{%= project.package %}/{{%- project.name %}View.kt → {%- project.viewName %}.kt } +1 -1
- package/example/babel.config.js +1 -1
- package/example/tsconfig.json +1 -1
- package/expo-module.config.json +2 -2
- package/ios/{{%- project.name %}Module.swift → {%- project.moduleName %}.swift } +3 -3
- package/ios/{%- project.name %}.podspec +2 -7
- package/ios/{{%- project.name %}View.swift → {%- project.viewName %}.swift } +1 -1
- package/package.json +2 -2
- package/src/index.ts +26 -0
- package/src/{{%- project.name %}Module.ts → {%- project.moduleName %}.ts} +0 -0
- package/src/{{%- project.name %}Module.web.ts → {%- project.moduleName %}.web.ts} +0 -0
- package/src/{%- project.name %}.types.ts +1 -1
- package/src/{%- project.viewName %}.tsx +11 -0
- package/src/{%- project.viewName %}.web.tsx +11 -0
- package/src/{%- project.name %}.ts +0 -29
- package/src/{%- project.name %}View.tsx +0 -11
- package/src/{%- project.name %}View.web.tsx +0 -13
package/$.gitignore
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# OSX
|
|
2
|
+
#
|
|
3
|
+
.DS_Store
|
|
4
|
+
|
|
5
|
+
# VSCode
|
|
6
|
+
.vscode/
|
|
7
|
+
jsconfig.json
|
|
8
|
+
|
|
9
|
+
# Xcode
|
|
10
|
+
#
|
|
11
|
+
build/
|
|
12
|
+
*.pbxuser
|
|
13
|
+
!default.pbxuser
|
|
14
|
+
*.mode1v3
|
|
15
|
+
!default.mode1v3
|
|
16
|
+
*.mode2v3
|
|
17
|
+
!default.mode2v3
|
|
18
|
+
*.perspectivev3
|
|
19
|
+
!default.perspectivev3
|
|
20
|
+
xcuserdata
|
|
21
|
+
*.xccheckout
|
|
22
|
+
*.moved-aside
|
|
23
|
+
DerivedData
|
|
24
|
+
*.hmap
|
|
25
|
+
*.ipa
|
|
26
|
+
*.xcuserstate
|
|
27
|
+
project.xcworkspace
|
|
28
|
+
|
|
29
|
+
# Android/IJ
|
|
30
|
+
#
|
|
31
|
+
.classpath
|
|
32
|
+
.cxx
|
|
33
|
+
.gradle
|
|
34
|
+
.idea
|
|
35
|
+
.project
|
|
36
|
+
.settings
|
|
37
|
+
local.properties
|
|
38
|
+
android.iml
|
|
39
|
+
android/app/libs
|
|
40
|
+
android/keystores/debug.keystore
|
|
41
|
+
|
|
42
|
+
# Cocoapods
|
|
43
|
+
#
|
|
44
|
+
example/ios/Pods
|
|
45
|
+
|
|
46
|
+
# Ruby
|
|
47
|
+
example/vendor/
|
|
48
|
+
|
|
49
|
+
# node.js
|
|
50
|
+
#
|
|
51
|
+
node_modules/
|
|
52
|
+
npm-debug.log
|
|
53
|
+
yarn-debug.log
|
|
54
|
+
yarn-error.log
|
|
55
|
+
|
|
56
|
+
# Expo
|
|
57
|
+
.expo/*
|
package/$.npmignore
ADDED
package/$package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "<%- project.slug %>",
|
|
3
3
|
"version": "<%- project.version %>",
|
|
4
4
|
"description": "<%- project.description %>",
|
|
5
|
-
"main": "build
|
|
6
|
-
"types": "build
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"types": "build/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "expo-module build",
|
|
9
9
|
"clean": "expo-module clean",
|
|
@@ -30,8 +30,9 @@
|
|
|
30
30
|
"homepage": "<%- repo %>#readme",
|
|
31
31
|
"dependencies": {},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"
|
|
34
|
-
"expo-
|
|
33
|
+
"@types/react": "^18.0.25",
|
|
34
|
+
"expo-module-scripts": "^3.0.6",
|
|
35
|
+
"expo-modules-core": "^1.2.0"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
38
|
"expo": "*",
|
package/android/build.gradle
CHANGED
|
@@ -59,7 +59,7 @@ afterEvaluate {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
android {
|
|
62
|
-
compileSdkVersion safeExtGet("compileSdkVersion",
|
|
62
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 33)
|
|
63
63
|
|
|
64
64
|
compileOptions {
|
|
65
65
|
sourceCompatibility JavaVersion.VERSION_11
|
|
@@ -72,7 +72,7 @@ android {
|
|
|
72
72
|
|
|
73
73
|
defaultConfig {
|
|
74
74
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
75
|
-
targetSdkVersion safeExtGet("targetSdkVersion",
|
|
75
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
76
76
|
versionCode 1
|
|
77
77
|
versionName "<%- project.version %>"
|
|
78
78
|
}
|
|
@@ -3,7 +3,7 @@ package <%- project.package %>
|
|
|
3
3
|
import expo.modules.kotlin.modules.Module
|
|
4
4
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
5
5
|
|
|
6
|
-
class <%- project.
|
|
6
|
+
class <%- project.moduleName %> : Module() {
|
|
7
7
|
// Each module class must implement the definition function. The definition consists of components
|
|
8
8
|
// that describes the module's functionality and behavior.
|
|
9
9
|
// See https://docs.expo.dev/modules/module-api for more details about available components.
|
|
@@ -37,9 +37,9 @@ class <%- project.name %>Module : Module() {
|
|
|
37
37
|
|
|
38
38
|
// Enables the module to be used as a native view. Definition components that are accepted as part of
|
|
39
39
|
// the view definition: Prop, Events.
|
|
40
|
-
View(<%- project.
|
|
40
|
+
View(<%- project.viewName %>::class) {
|
|
41
41
|
// Defines a setter for the `name` prop.
|
|
42
|
-
Prop("name") { view: <%- project.
|
|
42
|
+
Prop("name") { view: <%- project.viewName %>, prop: String ->
|
|
43
43
|
println(prop)
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -4,4 +4,4 @@ import android.content.Context
|
|
|
4
4
|
import expo.modules.kotlin.AppContext
|
|
5
5
|
import expo.modules.kotlin.views.ExpoView
|
|
6
6
|
|
|
7
|
-
class <%- project.
|
|
7
|
+
class <%- project.viewName %>(context: Context, appContext: AppContext) : ExpoView(context, appContext)
|
package/example/babel.config.js
CHANGED
|
@@ -10,7 +10,7 @@ module.exports = function (api) {
|
|
|
10
10
|
extensions: ['.tsx', '.ts', '.js', '.json'],
|
|
11
11
|
alias: {
|
|
12
12
|
// For development, we want to alias the library to the source
|
|
13
|
-
'<%- project.slug %>': path.join(__dirname, '..', 'src', '
|
|
13
|
+
'<%- project.slug %>': path.join(__dirname, '..', 'src', 'index.ts'),
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
],
|
package/example/tsconfig.json
CHANGED
package/expo-module.config.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"platforms": ["ios", "android", "web"],
|
|
3
3
|
"ios": {
|
|
4
|
-
"modules": ["<%- project.
|
|
4
|
+
"modules": ["<%- project.moduleName %>"]
|
|
5
5
|
},
|
|
6
6
|
"android": {
|
|
7
|
-
"modules": ["<%- project.package %>.<%- project.
|
|
7
|
+
"modules": ["<%- project.package %>.<%- project.moduleName %>"]
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ExpoModulesCore
|
|
2
2
|
|
|
3
|
-
public class <%- project.
|
|
3
|
+
public class <%- project.moduleName %>: Module {
|
|
4
4
|
// Each module class must implement the definition function. The definition consists of components
|
|
5
5
|
// that describes the module's functionality and behavior.
|
|
6
6
|
// See https://docs.expo.dev/modules/module-api for more details about available components.
|
|
@@ -34,9 +34,9 @@ public class <%- project.name %>Module: Module {
|
|
|
34
34
|
|
|
35
35
|
// Enables the module to be used as a native view. Definition components that are accepted as part of the
|
|
36
36
|
// view definition: Prop, Events.
|
|
37
|
-
View(<%- project.
|
|
37
|
+
View(<%- project.viewName %>.self) {
|
|
38
38
|
// Defines a setter for the `name` prop.
|
|
39
|
-
Prop("name") { (view: <%- project.
|
|
39
|
+
Prop("name") { (view: <%- project.viewName %>, prop: String) in
|
|
40
40
|
print(prop)
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -22,11 +22,6 @@ Pod::Spec.new do |s|
|
|
|
22
22
|
'DEFINES_MODULE' => 'YES',
|
|
23
23
|
'SWIFT_COMPILATION_MODE' => 'wholemodule'
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
s.source_files = "**/*.h"
|
|
28
|
-
s.vendored_frameworks = "#{s.name}.xcframework"
|
|
29
|
-
else
|
|
30
|
-
s.source_files = "**/*.{h,m,swift}"
|
|
31
|
-
end
|
|
25
|
+
|
|
26
|
+
s.source_files = "**/*.{h,m,swift}"
|
|
32
27
|
end
|
|
@@ -2,6 +2,6 @@ import ExpoModulesCore
|
|
|
2
2
|
|
|
3
3
|
// This view will be used as a native component. Make sure to inherit from `ExpoView`
|
|
4
4
|
// to apply the proper styling (e.g. border radius and shadows).
|
|
5
|
-
class <%- project.
|
|
5
|
+
class <%- project.viewName %>: ExpoView {
|
|
6
6
|
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-module-template",
|
|
3
|
-
"version": "10.7.
|
|
3
|
+
"version": "10.7.15",
|
|
4
4
|
"description": "ExpoModuleTemplate standalone module",
|
|
5
5
|
"main": "build/ModuleTemplate.js",
|
|
6
6
|
"types": "build/ModuleTemplate.d.ts",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"dependencies": {},
|
|
25
25
|
"devDependencies": {},
|
|
26
26
|
"peerDependencies": {},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "1815e2eaad8c753588c7b1eb74420174a28e01f4"
|
|
28
28
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NativeModulesProxy, EventEmitter, Subscription } from 'expo-modules-core';
|
|
2
|
+
|
|
3
|
+
// Import the native module. On web, it will be resolved to <%- project.name %>.web.ts
|
|
4
|
+
// and on native platforms to <%- project.name %>.ts
|
|
5
|
+
import <%- project.moduleName %> from './<%- project.moduleName %>';
|
|
6
|
+
import <%- project.viewName %> from './<%- project.viewName %>';
|
|
7
|
+
import { ChangeEventPayload, <%- project.viewName %>Props } from './<%- project.name %>.types';
|
|
8
|
+
|
|
9
|
+
// Get the native constant value.
|
|
10
|
+
export const PI = <%- project.moduleName %>.PI;
|
|
11
|
+
|
|
12
|
+
export function hello(): string {
|
|
13
|
+
return <%- project.moduleName %>.hello();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function setValueAsync(value: string) {
|
|
17
|
+
return await <%- project.moduleName %>.setValueAsync(value);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const emitter = new EventEmitter(<%- project.moduleName %> ?? NativeModulesProxy.<%- project.name %>);
|
|
21
|
+
|
|
22
|
+
export function addChangeListener(listener: (event: ChangeEventPayload) => void): Subscription {
|
|
23
|
+
return emitter.addListener<ChangeEventPayload>('onChange', listener);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { <%- project.viewName %>, <%- project.viewName %>Props, ChangeEventPayload };
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { requireNativeViewManager } from 'expo-modules-core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { <%- project.viewName %>Props } from './<%- project.name %>.types';
|
|
5
|
+
|
|
6
|
+
const NativeView: React.ComponentType<<%- project.viewName %>Props> =
|
|
7
|
+
requireNativeViewManager('<%- project.name %>');
|
|
8
|
+
|
|
9
|
+
export default function <%- project.viewName %>(props: <%- project.viewName %>Props) {
|
|
10
|
+
return <NativeView {...props} />;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { <%- project.viewName %>Props } from './<%- project.name %>.types';
|
|
4
|
+
|
|
5
|
+
export default function <%- project.viewName %>(props: <%- project.viewName %>Props) {
|
|
6
|
+
return (
|
|
7
|
+
<div>
|
|
8
|
+
<span>{props.name}</span>
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { NativeModulesProxy, EventEmitter, Subscription } from 'expo-modules-core';
|
|
2
|
-
|
|
3
|
-
// Import the native module. On web, it will be resolved to <%- project.name %>.web.ts
|
|
4
|
-
// and on native platforms to <%- project.name %>.ts
|
|
5
|
-
import <%- project.name %> from './<%- project.name %>Module';
|
|
6
|
-
import <%- project.name %>View from './<%- project.name %>View';
|
|
7
|
-
import { ChangeEventPayload, <%- project.name %>ViewProps } from './<%- project.name %>.types';
|
|
8
|
-
|
|
9
|
-
// Get the native constant value.
|
|
10
|
-
export const PI = <%- project.name %>.PI;
|
|
11
|
-
|
|
12
|
-
export function hello(): string {
|
|
13
|
-
return <%- project.name %>.hello();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export async function setValueAsync(value: string) {
|
|
17
|
-
return await <%- project.name %>.setValueAsync(value);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// For now the events are not going through the JSI, so we have to use its bridge equivalent.
|
|
21
|
-
// This will be fixed in the stable release and built into the module object.
|
|
22
|
-
// Note: On web, NativeModulesProxy.<%- project.name %> is undefined, so we fall back to the directly imported implementation
|
|
23
|
-
const emitter = new EventEmitter(NativeModulesProxy.<%- project.name %> ?? <%- project.name %>);
|
|
24
|
-
|
|
25
|
-
export function addChangeListener(listener: (event: ChangeEventPayload) => void): Subscription {
|
|
26
|
-
return emitter.addListener<ChangeEventPayload>('onChange', listener);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { <%- project.name %>View, <%- project.name %>ViewProps, ChangeEventPayload };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { requireNativeViewManager } from 'expo-modules-core';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
import { <%- project.name %>ViewProps } from './<%- project.name %>.types';
|
|
5
|
-
|
|
6
|
-
const NativeView: React.ComponentType<<%- project.name %>ViewProps> =
|
|
7
|
-
requireNativeViewManager('<%- project.name %>');
|
|
8
|
-
|
|
9
|
-
export default function <%- project.name %>View(props: <%- project.name %>ViewProps) {
|
|
10
|
-
return <NativeView name={props.name} />;
|
|
11
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { <%- project.name %>ViewProps } from './<%- project.name %>.types';
|
|
4
|
-
|
|
5
|
-
function <%- project.name %>WebView(props: <%- project.name %>ViewProps) {
|
|
6
|
-
return (
|
|
7
|
-
<div>
|
|
8
|
-
<span>{props.name}</span>
|
|
9
|
-
</div>
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default <%- project.name %>WebView;
|