remove unnecessary android/web stuff
This commit is contained in:
@@ -1,89 +0,0 @@
|
|||||||
apply plugin: 'com.android.library'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
apply plugin: 'maven-publish'
|
|
||||||
|
|
||||||
group = 'expo.modules.selectabletext'
|
|
||||||
version = '0.2.0'
|
|
||||||
|
|
||||||
buildscript {
|
|
||||||
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
||||||
if (expoModulesCorePlugin.exists()) {
|
|
||||||
apply from: expoModulesCorePlugin
|
|
||||||
applyKotlinExpoModulesCorePlugin()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Simple helper that allows the root project to override versions declared by this library.
|
|
||||||
ext.safeExtGet = { prop, fallback ->
|
|
||||||
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensures backward compatibility
|
|
||||||
ext.getKotlinVersion = {
|
|
||||||
if (ext.has("kotlinVersion")) {
|
|
||||||
ext.kotlinVersion()
|
|
||||||
} else {
|
|
||||||
ext.safeExtGet("kotlinVersion", "1.8.10")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
release(MavenPublication) {
|
|
||||||
from components.release
|
|
||||||
}
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url = mavenLocal().url
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion safeExtGet("compileSdkVersion", 33)
|
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
|
||||||
targetCompatibility JavaVersion.VERSION_11
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace "expo.modules.selectabletext"
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
||||||
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
||||||
versionCode 1
|
|
||||||
versionName "0.2.0"
|
|
||||||
}
|
|
||||||
lintOptions {
|
|
||||||
abortOnError false
|
|
||||||
}
|
|
||||||
publishing {
|
|
||||||
singleVariant("release") {
|
|
||||||
withSourcesJar()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation project(':expo-modules-core')
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
||||||
}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<manifest>
|
|
||||||
</manifest>
|
|
||||||
-47
@@ -1,47 +0,0 @@
|
|||||||
package expo.modules.selectabletext
|
|
||||||
|
|
||||||
import expo.modules.kotlin.modules.Module
|
|
||||||
import expo.modules.kotlin.modules.ModuleDefinition
|
|
||||||
|
|
||||||
class ExpoSelectableTextModule : Module() {
|
|
||||||
// Each module class must implement the definition function. The definition consists of components
|
|
||||||
// that describes the module's functionality and behavior.
|
|
||||||
// See https://docs.expo.dev/modules/module-api for more details about available components.
|
|
||||||
override fun definition() = ModuleDefinition {
|
|
||||||
// Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.
|
|
||||||
// Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.
|
|
||||||
// The module will be accessible from `requireNativeModule('ExpoSelectableText')` in JavaScript.
|
|
||||||
Name("ExpoSelectableText")
|
|
||||||
|
|
||||||
// Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary.
|
|
||||||
Constants(
|
|
||||||
"PI" to Math.PI
|
|
||||||
)
|
|
||||||
|
|
||||||
// Defines event names that the module can send to JavaScript.
|
|
||||||
Events("onChange")
|
|
||||||
|
|
||||||
// Defines a JavaScript synchronous function that runs the native code on the JavaScript thread.
|
|
||||||
Function("hello") {
|
|
||||||
"Hello world! 👋"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Defines a JavaScript function that always returns a Promise and whose native code
|
|
||||||
// is by default dispatched on the different thread than the JavaScript runtime runs on.
|
|
||||||
AsyncFunction("setValueAsync") { value: String ->
|
|
||||||
// Send an event to JavaScript.
|
|
||||||
sendEvent("onChange", mapOf(
|
|
||||||
"value" to value
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enables the module to be used as a native view. Definition components that are accepted as part of
|
|
||||||
// the view definition: Prop, Events.
|
|
||||||
View(ExpoSelectableTextView::class) {
|
|
||||||
// Defines a setter for the `name` prop.
|
|
||||||
Prop("name") { view: ExpoSelectableTextView, prop: String ->
|
|
||||||
println(prop)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-7
@@ -1,7 +0,0 @@
|
|||||||
package expo.modules.selectabletext
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import expo.modules.kotlin.AppContext
|
|
||||||
import expo.modules.kotlin.views.ExpoView
|
|
||||||
|
|
||||||
class ExpoSelectableTextView(context: Context, appContext: AppContext) : ExpoView(context, appContext)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import * as React from 'react'
|
|
||||||
|
|
||||||
import {ExpoProTextViewProps} from './ExpoSelectableText.types'
|
|
||||||
|
|
||||||
export default function ExpoProTextView(props: ExpoProTextViewProps) {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<span>{props.name}</span>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { requireNativeModule } from 'expo-modules-core';
|
import {requireNativeModule} from 'expo-modules-core'
|
||||||
|
|
||||||
// It loads the native module object from the JSI or falls back to
|
// It loads the native module object from the JSI or falls back to
|
||||||
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
|
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
|
||||||
export default requireNativeModule('ExpoProText');
|
export default requireNativeModule('ExpoProText')
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
import { EventEmitter } from 'expo-modules-core';
|
|
||||||
|
|
||||||
const emitter = new EventEmitter({} as any);
|
|
||||||
|
|
||||||
export default {
|
|
||||||
PI: Math.PI,
|
|
||||||
async setValueAsync(value: string): Promise<void> {
|
|
||||||
emitter.emit('onChange', { value });
|
|
||||||
},
|
|
||||||
hello() {
|
|
||||||
return 'Hello world! 👋';
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
ExpoProTextSegment,
|
ExpoProTextSegment,
|
||||||
ExpoProTextViewProps,
|
ExpoProTextViewProps,
|
||||||
} from './ExpoSelectableText.types'
|
} from './ExpoSelectableText.types'
|
||||||
import {StyleSheet, Text, View} from 'react-native'
|
import {Text, View} from 'react-native'
|
||||||
|
|
||||||
const NativeView: React.ComponentType<ExpoProTextNativeViewProps> =
|
const NativeView: React.ComponentType<ExpoProTextNativeViewProps> =
|
||||||
requireNativeViewManager('ExpoSelectableText')
|
requireNativeViewManager('ExpoSelectableText')
|
||||||
|
|||||||
Reference in New Issue
Block a user