@whetware/react-native-stroke-text 0.0.5 → 0.0.7
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/CHANGELOG.md +6 -0
- package/lib/StrokeText.js +18 -26
- package/lib/StrokeText.web.js +1 -1
- package/package.json +14 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @whetware/react-native-stroke-text
|
|
2
2
|
|
|
3
|
+
## 0.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f8a9483`](https://github.com/whetware/react-native-stroke-text/commit/f8a9483d80eebe2149b84a47da7a2178341c5c9f) Thanks [@evelant](https://github.com/evelant)! - Fix layout on Android
|
|
8
|
+
|
|
3
9
|
## 0.0.5
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/lib/StrokeText.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
3
3
|
import { callback, getHostComponent } from 'react-native-nitro-modules';
|
|
4
4
|
import StrokeTextViewConfig from '../nitrogen/generated/shared/json/StrokeTextViewConfig.json';
|
|
5
5
|
const NativeStrokeTextView = getHostComponent('StrokeTextView', () => StrokeTextViewConfig);
|
|
@@ -71,24 +71,6 @@ export function StrokeText({ text, children, style, hybridRef, ...rest }) {
|
|
|
71
71
|
const baseRight = firstNumber(paddingRight, stylePaddingRight, paddingHorizontal, stylePaddingHorizontal, padding, stylePadding) ?? 0;
|
|
72
72
|
const baseBottom = firstNumber(paddingBottom, stylePaddingBottom, paddingVertical, stylePaddingVertical, padding, stylePadding) ?? 0;
|
|
73
73
|
const baseLeft = firstNumber(paddingLeft, stylePaddingLeft, paddingHorizontal, stylePaddingHorizontal, padding, stylePadding) ?? 0;
|
|
74
|
-
const baseMarginTop = firstNumber(containerStyle.marginTop, containerStyle.marginVertical, containerStyle.margin) ?? 0;
|
|
75
|
-
const baseMarginRight = firstNumber(containerStyle.marginRight, I18nManager.isRTL ? containerStyle.marginStart : containerStyle.marginEnd, containerStyle.marginHorizontal, containerStyle.margin) ?? 0;
|
|
76
|
-
const baseMarginBottom = firstNumber(containerStyle.marginBottom, containerStyle.marginVertical, containerStyle.margin) ?? 0;
|
|
77
|
-
const baseMarginLeft = firstNumber(containerStyle.marginLeft, I18nManager.isRTL ? containerStyle.marginEnd : containerStyle.marginStart, containerStyle.marginHorizontal, containerStyle.margin) ?? 0;
|
|
78
|
-
const baseMarginStart = toNumber(containerStyle.marginStart);
|
|
79
|
-
const baseMarginEnd = toNumber(containerStyle.marginEnd);
|
|
80
|
-
const strokeInsetMarginStyle = strokeInset === 0
|
|
81
|
-
? null
|
|
82
|
-
: {
|
|
83
|
-
marginTop: baseMarginTop - strokeInset,
|
|
84
|
-
marginRight: baseMarginRight - strokeInset,
|
|
85
|
-
marginBottom: baseMarginBottom - strokeInset,
|
|
86
|
-
marginLeft: baseMarginLeft - strokeInset,
|
|
87
|
-
...(baseMarginStart == null
|
|
88
|
-
? {}
|
|
89
|
-
: { marginStart: baseMarginStart - strokeInset }),
|
|
90
|
-
...(baseMarginEnd == null ? {} : { marginEnd: baseMarginEnd - strokeInset }),
|
|
91
|
-
};
|
|
92
74
|
const effectiveNumberOfLines = nativeProps.numberOfLines != null && nativeProps.numberOfLines > 0
|
|
93
75
|
? nativeProps.numberOfLines
|
|
94
76
|
: undefined;
|
|
@@ -140,23 +122,33 @@ export function StrokeText({ text, children, style, hybridRef, ...rest }) {
|
|
|
140
122
|
effectiveTextTransform,
|
|
141
123
|
effectiveIncludeFontPadding,
|
|
142
124
|
]);
|
|
143
|
-
return (React.createElement(View, { style: [styles.container, containerStyle
|
|
125
|
+
return (React.createElement(View, { style: [styles.container, containerStyle] },
|
|
144
126
|
React.createElement(Text, { accessible: false, pointerEvents: "none", numberOfLines: effectiveNumberOfLines, ellipsizeMode: effectiveEllipsizeMode, allowFontScaling: nativeProps.allowFontScaling, maxFontSizeMultiplier: nativeProps.maxFontSizeMultiplier, style: [
|
|
145
127
|
measurerTextStyle,
|
|
146
128
|
{
|
|
147
|
-
paddingTop: baseTop
|
|
148
|
-
paddingRight: baseRight
|
|
149
|
-
paddingBottom: baseBottom
|
|
150
|
-
paddingLeft: baseLeft
|
|
129
|
+
paddingTop: baseTop,
|
|
130
|
+
paddingRight: baseRight,
|
|
131
|
+
paddingBottom: baseBottom,
|
|
132
|
+
paddingLeft: baseLeft,
|
|
151
133
|
},
|
|
152
134
|
styles.hiddenText,
|
|
153
135
|
] }, resolvedText),
|
|
154
|
-
React.createElement(NativeStrokeTextView, { ...nativeProps, text: resolvedText, color: effectiveColor, fontSize: effectiveFontSize, fontWeight: effectiveFontWeight, fontFamily: effectiveFontFamily, fontStyle: effectiveFontStyle, lineHeight: effectiveLineHeight, letterSpacing: effectiveLetterSpacing, textAlign: effectiveTextAlign, textAlignVertical: effectiveTextAlignVertical, textDecorationLine: effectiveTextDecorationLine, textTransform: effectiveTextTransform, opacity: nativeProps.opacity ?? toNumber(styleOpacity), includeFontPadding: effectiveIncludeFontPadding, numberOfLines: nativeProps.numberOfLines, ellipsizeMode: effectiveEllipsizeMode, paddingTop: baseTop, paddingRight: baseRight, paddingBottom: baseBottom, paddingLeft: baseLeft, hybridRef: wrappedHybridRef, pointerEvents: "none", style:
|
|
136
|
+
React.createElement(NativeStrokeTextView, { ...nativeProps, text: resolvedText, color: effectiveColor, fontSize: effectiveFontSize, fontWeight: effectiveFontWeight, fontFamily: effectiveFontFamily, fontStyle: effectiveFontStyle, lineHeight: effectiveLineHeight, letterSpacing: effectiveLetterSpacing, textAlign: effectiveTextAlign, textAlignVertical: effectiveTextAlignVertical, textDecorationLine: effectiveTextDecorationLine, textTransform: effectiveTextTransform, opacity: nativeProps.opacity ?? toNumber(styleOpacity), includeFontPadding: effectiveIncludeFontPadding, numberOfLines: nativeProps.numberOfLines, ellipsizeMode: effectiveEllipsizeMode, paddingTop: baseTop, paddingRight: baseRight, paddingBottom: baseBottom, paddingLeft: baseLeft, hybridRef: wrappedHybridRef, pointerEvents: "none", style: [
|
|
137
|
+
styles.overlay,
|
|
138
|
+
strokeInset === 0
|
|
139
|
+
? null
|
|
140
|
+
: {
|
|
141
|
+
top: -strokeInset,
|
|
142
|
+
right: -strokeInset,
|
|
143
|
+
bottom: -strokeInset,
|
|
144
|
+
left: -strokeInset,
|
|
145
|
+
},
|
|
146
|
+
] })));
|
|
155
147
|
}
|
|
156
148
|
const styles = StyleSheet.create({
|
|
157
149
|
container: {},
|
|
158
150
|
overlay: {
|
|
159
|
-
...StyleSheet.
|
|
151
|
+
...StyleSheet.absoluteFill,
|
|
160
152
|
},
|
|
161
153
|
hiddenText: {
|
|
162
154
|
opacity: 0,
|
package/lib/StrokeText.web.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whetware/react-native-stroke-text",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Stroke/outline text for React Native (New Architecture) on iOS, Android, and Web.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -28,6 +28,19 @@
|
|
|
28
28
|
"CHANGELOG.md",
|
|
29
29
|
"README.md"
|
|
30
30
|
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"clean": "rm -rf android/build node_modules/**/android/build lib",
|
|
34
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
|
|
35
|
+
"lint-ci": "eslint \"**/*.{js,ts,tsx}\"",
|
|
36
|
+
"typescript": "tsc",
|
|
37
|
+
"prepare": "npm run prepack",
|
|
38
|
+
"prepack": "tsc",
|
|
39
|
+
"changeset": "changeset",
|
|
40
|
+
"version-packages": "changeset version",
|
|
41
|
+
"release": "changeset publish",
|
|
42
|
+
"specs": "tsc --noEmit false && nitrogen --logLevel=\"debug\""
|
|
43
|
+
},
|
|
31
44
|
"keywords": [
|
|
32
45
|
"react-native",
|
|
33
46
|
"nitro",
|
|
@@ -107,16 +120,5 @@
|
|
|
107
120
|
"trailingComma": "es5",
|
|
108
121
|
"useTabs": false,
|
|
109
122
|
"semi": false
|
|
110
|
-
},
|
|
111
|
-
"scripts": {
|
|
112
|
-
"typecheck": "tsc --noEmit",
|
|
113
|
-
"clean": "rm -rf android/build node_modules/**/android/build lib",
|
|
114
|
-
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
|
|
115
|
-
"lint-ci": "eslint \"**/*.{js,ts,tsx}\"",
|
|
116
|
-
"typescript": "tsc",
|
|
117
|
-
"changeset": "changeset",
|
|
118
|
-
"version-packages": "changeset version",
|
|
119
|
-
"release": "changeset publish",
|
|
120
|
-
"specs": "tsc --noEmit false && nitrogen --logLevel=\"debug\""
|
|
121
123
|
}
|
|
122
124
|
}
|