Skip to content

Commit 1fcd5fb

Browse files
committed
Initial commit
Generated by create-expo-module 0.6.2.
0 parents  commit 1fcd5fb

File tree

102 files changed

+35146
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+35146
-0
lines changed

.eslintrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['universe/native', 'universe/web'],
4+
ignorePatterns: ['build'],
5+
};

.gitignore

+57
Original file line numberDiff line numberDiff line change
@@ -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/*

.npmignore

+11
Original file line numberDiff line numberDiff line change
@@ -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/

android/build.gradle

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
apply plugin: 'com.android.library'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'maven-publish'
4+
5+
group = 'expo.modules.speechrecognition'
6+
version = '0.1.0'
7+
8+
buildscript {
9+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
10+
if (expoModulesCorePlugin.exists()) {
11+
apply from: expoModulesCorePlugin
12+
applyKotlinExpoModulesCorePlugin()
13+
}
14+
15+
// Simple helper that allows the root project to override versions declared by this library.
16+
ext.safeExtGet = { prop, fallback ->
17+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
18+
}
19+
20+
// Ensures backward compatibility
21+
ext.getKotlinVersion = {
22+
if (ext.has("kotlinVersion")) {
23+
ext.kotlinVersion()
24+
} else {
25+
ext.safeExtGet("kotlinVersion", "1.8.10")
26+
}
27+
}
28+
29+
repositories {
30+
mavenCentral()
31+
}
32+
33+
dependencies {
34+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
35+
}
36+
}
37+
38+
afterEvaluate {
39+
publishing {
40+
publications {
41+
release(MavenPublication) {
42+
from components.release
43+
}
44+
}
45+
repositories {
46+
maven {
47+
url = mavenLocal().url
48+
}
49+
}
50+
}
51+
}
52+
53+
android {
54+
compileSdkVersion safeExtGet("compileSdkVersion", 33)
55+
56+
compileOptions {
57+
sourceCompatibility JavaVersion.VERSION_11
58+
targetCompatibility JavaVersion.VERSION_11
59+
}
60+
61+
kotlinOptions {
62+
jvmTarget = JavaVersion.VERSION_11.majorVersion
63+
}
64+
65+
namespace "expo.modules.speechrecognition"
66+
defaultConfig {
67+
minSdkVersion safeExtGet("minSdkVersion", 21)
68+
targetSdkVersion safeExtGet("targetSdkVersion", 33)
69+
versionCode 1
70+
versionName "0.1.0"
71+
}
72+
lintOptions {
73+
abortOnError false
74+
}
75+
publishing {
76+
singleVariant("release") {
77+
withSourcesJar()
78+
}
79+
}
80+
}
81+
82+
repositories {
83+
mavenCentral()
84+
}
85+
86+
dependencies {
87+
implementation project(':expo-modules-core')
88+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
89+
}

android/src/main/AndroidManifest.xml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<manifest>
2+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package expo.modules.speechrecognition
2+
3+
import expo.modules.kotlin.modules.Module
4+
import expo.modules.kotlin.modules.ModuleDefinition
5+
6+
class ExpoSpeechRecognitionModule : Module() {
7+
// Each module class must implement the definition function. The definition consists of components
8+
// that describes the module's functionality and behavior.
9+
// See https://docs.expo.dev/modules/module-api for more details about available components.
10+
override fun definition() = ModuleDefinition {
11+
// Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
12+
// Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
13+
// The module will be accessible from `requireNativeModule('ExpoSpeechRecognition')` in JavaScript.
14+
Name("ExpoSpeechRecognition")
15+
16+
// Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary.
17+
Constants(
18+
"PI" to Math.PI
19+
)
20+
21+
// Defines event names that the module can send to JavaScript.
22+
Events("onChange")
23+
24+
// Defines a JavaScript synchronous function that runs the native code on the JavaScript thread.
25+
Function("hello") {
26+
"Hello world! 👋"
27+
}
28+
29+
// Defines a JavaScript function that always returns a Promise and whose native code
30+
// is by default dispatched on the different thread than the JavaScript runtime runs on.
31+
AsyncFunction("setValueAsync") { value: String ->
32+
// Send an event to JavaScript.
33+
sendEvent("onChange", mapOf(
34+
"value" to value
35+
))
36+
}
37+
38+
// Enables the module to be used as a native view. Definition components that are accepted as part of
39+
// the view definition: Prop, Events.
40+
View(ExpoSpeechRecognitionView::class) {
41+
// Defines a setter for the `name` prop.
42+
Prop("name") { view: ExpoSpeechRecognitionView, prop: String ->
43+
println(prop)
44+
}
45+
}
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package expo.modules.speechrecognition
2+
3+
import android.content.Context
4+
import expo.modules.kotlin.AppContext
5+
import expo.modules.kotlin.views.ExpoView
6+
7+
class ExpoSpeechRecognitionView(context: Context, appContext: AppContext) : ExpoView(context, appContext)

example/.gitignore

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2+
3+
# dependencies
4+
node_modules/
5+
6+
# Expo
7+
.expo/
8+
dist/
9+
web-build/
10+
11+
# Native
12+
*.orig.*
13+
*.jks
14+
*.p8
15+
*.p12
16+
*.key
17+
*.mobileprovision
18+
19+
# Metro
20+
.metro-health-check*
21+
22+
# debug
23+
npm-debug.*
24+
yarn-debug.*
25+
yarn-error.*
26+
27+
# macOS
28+
.DS_Store
29+
*.pem
30+
31+
# local env files
32+
.env*.local
33+
34+
# typescript
35+
*.tsbuildinfo

example/App.tsx

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { StyleSheet, Text, View } from 'react-native';
2+
3+
import * as ExpoSpeechRecognition from 'expo-speech-recognition';
4+
5+
export default function App() {
6+
return (
7+
<View style={styles.container}>
8+
<Text>{ExpoSpeechRecognition.hello()}</Text>
9+
</View>
10+
);
11+
}
12+
13+
const styles = StyleSheet.create({
14+
container: {
15+
flex: 1,
16+
backgroundColor: '#fff',
17+
alignItems: 'center',
18+
justifyContent: 'center',
19+
},
20+
});

example/android/.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Android/IntelliJ
6+
#
7+
build/
8+
.idea
9+
.gradle
10+
local.properties
11+
*.iml
12+
*.hprof
13+
14+
# Bundle artifacts
15+
*.jsbundle

0 commit comments

Comments
 (0)