@onekeyfe/react-native-text 3.0.108
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 +21 -0
- package/README.md +17 -0
- package/android/build.gradle +109 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/onekey/text/OneKeyTextPackage.kt +21 -0
- package/android/src/main/java/com/onekey/text/OneKeyTextView.kt +6 -0
- package/android/src/main/java/com/onekey/text/OneKeyTextViewManager.kt +34 -0
- package/android/src/main/jni/CMakeLists.txt +31 -0
- package/android/src/main/jni/react/renderer/components/RNOneKeyTextSpec/ComponentDescriptors.h +45 -0
- package/lib/module/OneKeyTextNativeComponent.ts +100 -0
- package/lib/module/OneKeyTextNativeHost.js +35 -0
- package/lib/module/Text.android.js +335 -0
- package/lib/module/Text.js +5 -0
- package/lib/module/codegen-types.d.js +2 -0
- package/lib/module/index.js +5 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +4 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/OneKeyTextNativeComponent.d.ts +47 -0
- package/lib/typescript/src/OneKeyTextNativeHost.d.ts +32 -0
- package/lib/typescript/src/Text.android.d.ts +79 -0
- package/lib/typescript/src/Text.d.ts +6 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/types.d.ts +3 -0
- package/package.json +118 -0
- package/react-native.config.js +13 -0
- package/src/OneKeyTextNativeComponent.ts +100 -0
- package/src/OneKeyTextNativeHost.ts +40 -0
- package/src/Text.android.tsx +475 -0
- package/src/Text.tsx +3 -0
- package/src/codegen-types.d.ts +39 -0
- package/src/index.ts +4 -0
- package/src/types.ts +3 -0
package/package.json
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@onekeyfe/react-native-text",
|
|
3
|
+
"version": "3.0.108",
|
|
4
|
+
"description": "Opt-in native text rendering for React Native",
|
|
5
|
+
"source": "./src/index.ts",
|
|
6
|
+
"main": "./lib/module/index.js",
|
|
7
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"src",
|
|
18
|
+
"lib",
|
|
19
|
+
"android",
|
|
20
|
+
"react-native.config.js",
|
|
21
|
+
"!android/build",
|
|
22
|
+
"!android/gradle",
|
|
23
|
+
"!android/gradlew",
|
|
24
|
+
"!android/gradlew.bat",
|
|
25
|
+
"!android/local.properties",
|
|
26
|
+
"!**/__tests__",
|
|
27
|
+
"!**/__fixtures__",
|
|
28
|
+
"!**/__mocks__",
|
|
29
|
+
"!**/.*",
|
|
30
|
+
"!**/*.map"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"clean": "del-cli android/build lib",
|
|
34
|
+
"prepare": "rm -rf lib && bob build",
|
|
35
|
+
"typecheck": "tsc",
|
|
36
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
37
|
+
"test": "jest",
|
|
38
|
+
"release": "yarn prepare && npm whoami && npm publish --access public"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"react-native",
|
|
42
|
+
"android",
|
|
43
|
+
"text"
|
|
44
|
+
],
|
|
45
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules#readme",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/OneKeyHQ/app-modules.git",
|
|
49
|
+
"directory": "native-views/react-native-text"
|
|
50
|
+
},
|
|
51
|
+
"author": "@onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"registry": "https://registry.npmjs.org/"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@eslint/compat": "^1.3.2",
|
|
58
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
59
|
+
"@eslint/js": "^9.35.0",
|
|
60
|
+
"@react-native/babel-preset": "0.86.2",
|
|
61
|
+
"@react-native/eslint-config": "0.86.2",
|
|
62
|
+
"@types/jest": "^29.5.14",
|
|
63
|
+
"@types/react": "^19.2.0",
|
|
64
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
65
|
+
"del-cli": "^6.0.0",
|
|
66
|
+
"eslint": "^9.35.0",
|
|
67
|
+
"eslint-config-prettier": "^10.1.8",
|
|
68
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
69
|
+
"jest": "^29.7.0",
|
|
70
|
+
"prettier": "^2.8.8",
|
|
71
|
+
"react": "19.2.3",
|
|
72
|
+
"react-native": "patch:react-native@npm%3A0.86.2#~/.yarn/patches/react-native-npm-0.86.2-c9d546616f.patch",
|
|
73
|
+
"react-native-builder-bob": "^0.40.13",
|
|
74
|
+
"react-test-renderer": "19.2.3",
|
|
75
|
+
"typescript": "^5.9.2"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"react": "*",
|
|
79
|
+
"react-native": "*"
|
|
80
|
+
},
|
|
81
|
+
"packageManager": "yarn@4.11.0",
|
|
82
|
+
"react-native-builder-bob": {
|
|
83
|
+
"source": "src",
|
|
84
|
+
"output": "lib",
|
|
85
|
+
"targets": [
|
|
86
|
+
[
|
|
87
|
+
"module",
|
|
88
|
+
{
|
|
89
|
+
"esm": true
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
[
|
|
93
|
+
"typescript",
|
|
94
|
+
{
|
|
95
|
+
"project": "tsconfig.build.json"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
"prettier": {
|
|
101
|
+
"quoteProps": "consistent",
|
|
102
|
+
"singleQuote": true,
|
|
103
|
+
"tabWidth": 2,
|
|
104
|
+
"trailingComma": "es5",
|
|
105
|
+
"useTabs": false
|
|
106
|
+
},
|
|
107
|
+
"jest": {
|
|
108
|
+
"preset": "react-native"
|
|
109
|
+
},
|
|
110
|
+
"codegenConfig": {
|
|
111
|
+
"name": "RNOneKeyTextSpec",
|
|
112
|
+
"type": "components",
|
|
113
|
+
"jsSrcsDir": "src",
|
|
114
|
+
"android": {
|
|
115
|
+
"javaPackageName": "com.onekey.text"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
dependency: {
|
|
3
|
+
platforms: {
|
|
4
|
+
android: {
|
|
5
|
+
cmakeListsPath: 'src/main/jni/CMakeLists.txt',
|
|
6
|
+
componentDescriptors: ['OneKeyTextComponentDescriptor'],
|
|
7
|
+
packageImportPath: 'import com.onekey.text.OneKeyTextPackage;',
|
|
8
|
+
packageInstance: 'new OneKeyTextPackage()',
|
|
9
|
+
},
|
|
10
|
+
ios: null,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
type ColorValue,
|
|
4
|
+
type HostComponent,
|
|
5
|
+
type ViewProps,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import type {
|
|
8
|
+
DirectEventHandler,
|
|
9
|
+
Float,
|
|
10
|
+
Int32,
|
|
11
|
+
WithDefault,
|
|
12
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
13
|
+
|
|
14
|
+
export interface NativeProps extends ViewProps {
|
|
15
|
+
adjustsFontSizeToFit?: WithDefault<boolean, false>;
|
|
16
|
+
allowFontScaling?: WithDefault<boolean, true>;
|
|
17
|
+
android_hyphenationFrequency?: WithDefault<
|
|
18
|
+
'full' | 'none' | 'normal',
|
|
19
|
+
'none'
|
|
20
|
+
>;
|
|
21
|
+
color?: ColorValue;
|
|
22
|
+
dataDetectorType?: WithDefault<
|
|
23
|
+
'all' | 'email' | 'link' | 'none' | 'phoneNumber',
|
|
24
|
+
'none'
|
|
25
|
+
>;
|
|
26
|
+
disabled?: WithDefault<boolean, false>;
|
|
27
|
+
dynamicTypeRamp?: WithDefault<
|
|
28
|
+
| 'body'
|
|
29
|
+
| 'callout'
|
|
30
|
+
| 'caption1'
|
|
31
|
+
| 'caption2'
|
|
32
|
+
| 'footnote'
|
|
33
|
+
| 'headline'
|
|
34
|
+
| 'largeTitle'
|
|
35
|
+
| 'subheadline'
|
|
36
|
+
| 'title1'
|
|
37
|
+
| 'title2'
|
|
38
|
+
| 'title3',
|
|
39
|
+
'body'
|
|
40
|
+
>;
|
|
41
|
+
ellipsizeMode?: WithDefault<'clip' | 'head' | 'middle' | 'tail', 'tail'>;
|
|
42
|
+
fontFamily?: string;
|
|
43
|
+
fontSize?: Float;
|
|
44
|
+
fontStyle?: WithDefault<'italic' | 'normal', 'normal'>;
|
|
45
|
+
fontVariant?: ReadonlyArray<string>;
|
|
46
|
+
fontWeight?: string;
|
|
47
|
+
includeFontPadding?: WithDefault<boolean, true>;
|
|
48
|
+
isHighlighted?: WithDefault<boolean, false>;
|
|
49
|
+
isPressable?: WithDefault<boolean, false>;
|
|
50
|
+
letterSpacing?: Float;
|
|
51
|
+
lineBreakModeIOS?: WithDefault<
|
|
52
|
+
'char' | 'clip' | 'head' | 'middle' | 'tail' | 'word',
|
|
53
|
+
'tail'
|
|
54
|
+
>;
|
|
55
|
+
lineBreakStrategyIOS?: WithDefault<
|
|
56
|
+
'hangul-word' | 'none' | 'push-out' | 'standard',
|
|
57
|
+
'none'
|
|
58
|
+
>;
|
|
59
|
+
lineHeight?: Float;
|
|
60
|
+
maxFontSizeMultiplier?: Float;
|
|
61
|
+
minimumFontScale?: Float;
|
|
62
|
+
numberOfLines?: WithDefault<Int32, 0>;
|
|
63
|
+
// The native descriptor uses ParagraphEventEmitter to supply RN's line payload.
|
|
64
|
+
onTextLayout?: DirectEventHandler<Readonly<{}>>;
|
|
65
|
+
selectable?: WithDefault<boolean, false>;
|
|
66
|
+
selectionColor?: ColorValue;
|
|
67
|
+
textAlign?: WithDefault<
|
|
68
|
+
'auto' | 'center' | 'justify' | 'left' | 'right',
|
|
69
|
+
'auto'
|
|
70
|
+
>;
|
|
71
|
+
textAlignVertical?: WithDefault<'auto' | 'bottom' | 'center' | 'top', 'auto'>;
|
|
72
|
+
textBreakStrategy?: WithDefault<
|
|
73
|
+
'balanced' | 'highQuality' | 'simple',
|
|
74
|
+
'highQuality'
|
|
75
|
+
>;
|
|
76
|
+
textDecorationColor?: ColorValue;
|
|
77
|
+
textDecorationLine?: WithDefault<
|
|
78
|
+
'line-through' | 'none' | 'underline' | 'underline line-through',
|
|
79
|
+
'none'
|
|
80
|
+
>;
|
|
81
|
+
textDecorationStyle?: WithDefault<
|
|
82
|
+
'dashed' | 'dotted' | 'double' | 'solid',
|
|
83
|
+
'solid'
|
|
84
|
+
>;
|
|
85
|
+
textShadowColor?: ColorValue;
|
|
86
|
+
textShadowOffset?: Readonly<{
|
|
87
|
+
height: Float;
|
|
88
|
+
width: Float;
|
|
89
|
+
}>;
|
|
90
|
+
textShadowRadius?: Float;
|
|
91
|
+
textTransform?: WithDefault<
|
|
92
|
+
'capitalize' | 'lowercase' | 'none' | 'uppercase',
|
|
93
|
+
'none'
|
|
94
|
+
>;
|
|
95
|
+
writingDirection?: WithDefault<'auto' | 'ltr' | 'rtl', 'auto'>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export default codegenNativeComponent<NativeProps>(
|
|
99
|
+
'OneKeyText'
|
|
100
|
+
) as HostComponent<NativeProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* eslint-disable @react-native/no-deep-imports */
|
|
2
|
+
import { createViewConfig } from 'react-native/Libraries/NativeComponent/ViewConfig';
|
|
3
|
+
import createReactNativeComponentClass from 'react-native/Libraries/Renderer/shims/createReactNativeComponentClass';
|
|
4
|
+
import type { HostComponent } from 'react-native';
|
|
5
|
+
|
|
6
|
+
import type { NativeProps } from './OneKeyTextNativeComponent';
|
|
7
|
+
|
|
8
|
+
export const ONEKEY_TEXT_VIEW_CONFIG = {
|
|
9
|
+
validAttributes: {
|
|
10
|
+
isHighlighted: true,
|
|
11
|
+
isPressable: true,
|
|
12
|
+
numberOfLines: true,
|
|
13
|
+
ellipsizeMode: true,
|
|
14
|
+
allowFontScaling: true,
|
|
15
|
+
dynamicTypeRamp: true,
|
|
16
|
+
maxFontSizeMultiplier: true,
|
|
17
|
+
disabled: true,
|
|
18
|
+
selectable: true,
|
|
19
|
+
selectionColor: true,
|
|
20
|
+
adjustsFontSizeToFit: true,
|
|
21
|
+
minimumFontScale: true,
|
|
22
|
+
textBreakStrategy: true,
|
|
23
|
+
onTextLayout: true,
|
|
24
|
+
dataDetectorType: true,
|
|
25
|
+
android_hyphenationFrequency: true,
|
|
26
|
+
lineBreakStrategyIOS: true,
|
|
27
|
+
},
|
|
28
|
+
directEventTypes: {
|
|
29
|
+
topTextLayout: {
|
|
30
|
+
registrationName: 'onTextLayout',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
uiViewClassName: 'OneKeyText',
|
|
34
|
+
} as const;
|
|
35
|
+
|
|
36
|
+
const OneKeyTextNativeHost = createReactNativeComponentClass('OneKeyText', () =>
|
|
37
|
+
createViewConfig(ONEKEY_TEXT_VIEW_CONFIG)
|
|
38
|
+
) as unknown as HostComponent<NativeProps>;
|
|
39
|
+
|
|
40
|
+
export default OneKeyTextNativeHost;
|