@whetware/react-native-stroke-text 0.0.5 → 0.0.6
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 +17 -25
- package/package.json +1 -1
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,18 +122,28 @@ 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: {},
|
package/package.json
CHANGED