expo-module-template 10.7.13 → 10.8.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/$.gitignore ADDED
@@ -0,0 +1,61 @@
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
+
40
+ # Cocoapods
41
+ #
42
+ example/ios/Pods
43
+
44
+ # Ruby
45
+ example/vendor/
46
+
47
+ # node.js
48
+ #
49
+ node_modules/
50
+ npm-debug.log
51
+ yarn-debug.log
52
+ yarn-error.log
53
+
54
+ # BUCK
55
+ buck-out/
56
+ \.buckd/
57
+ android/app/libs
58
+ android/keystores/debug.keystore
59
+
60
+ # Expo
61
+ .expo/*
package/$.npmignore ADDED
@@ -0,0 +1,11 @@
1
+ # Exclude all top-level hidden directories by convention
2
+ /.*/
3
+
4
+ __mocks__
5
+ __tests__
6
+
7
+ /babel.config.js
8
+ /android/src/androidTest/
9
+ /android/src/test/
10
+ /android/build/
11
+ /example/
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/<%- project.name %>.js",
6
- "types": "build/<%- project.name %>.d.ts",
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",
@@ -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.name %>Module : Module() {
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.name %>View::class) {
40
+ View(<%- project.viewName %>::class) {
41
41
  // Defines a setter for the `name` prop.
42
- Prop("name") { view: <%- project.name %>View, prop: String ->
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.name %>View(context: Context, appContext: AppContext) : ExpoView(context, appContext)
7
+ class <%- project.viewName %>(context: Context, appContext: AppContext) : ExpoView(context, appContext)
@@ -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', '<%- project.name %>.ts'),
13
+ '<%- project.slug %>': path.join(__dirname, '..', 'src', 'index.ts'),
14
14
  },
15
15
  },
16
16
  ],
@@ -3,7 +3,7 @@
3
3
  "compilerOptions": {
4
4
  "strict": true,
5
5
  "paths": {
6
- "<%- project.slug %>": ["../src/<%- project.name %>"],
6
+ "<%- project.slug %>": ["../src/index"],
7
7
  "<%- project.slug %>/*": ["../src/*"]
8
8
  }
9
9
  }
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "platforms": ["ios", "android", "web"],
3
3
  "ios": {
4
- "modules": ["<%- project.name %>Module"]
4
+ "modules": ["<%- project.moduleName %>"]
5
5
  },
6
6
  "android": {
7
- "modules": ["<%- project.package %>.<%- project.name %>Module"]
7
+ "modules": ["<%- project.package %>.<%- project.moduleName %>"]
8
8
  }
9
9
  }
@@ -1,6 +1,6 @@
1
1
  import ExpoModulesCore
2
2
 
3
- public class <%- project.name %>Module: Module {
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.name %>View.self) {
37
+ View(<%- project.viewName %>.self) {
38
38
  // Defines a setter for the `name` prop.
39
- Prop("name") { (view: <%- project.name %>View, prop: String) in
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
- if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
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.name %>View: ExpoView {
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.13",
3
+ "version": "10.8.0",
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": "1bc67275465be02dd20df306091bdb4d7f798278"
27
+ "gitHead": "caf250e77e77fd1d4e03d10f31f5b10857654e70"
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 };
@@ -2,6 +2,6 @@ export type ChangeEventPayload = {
2
2
  value: string;
3
3
  };
4
4
 
5
- export type <%- project.name %>ViewProps = {
5
+ export type <%- project.viewName %>Props = {
6
6
  name: string;
7
7
  };
@@ -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;