improvements to Text
This commit is contained in:
@@ -60,7 +60,7 @@ export function Text({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectable && isIOS) {
|
const textProps = React.useMemo(() => {
|
||||||
const flattened = StyleSheet.flatten([
|
const flattened = StyleSheet.flatten([
|
||||||
s.black,
|
s.black,
|
||||||
typography,
|
typography,
|
||||||
@@ -74,49 +74,46 @@ export function Text({
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (flattened.fontSize) {
|
if (flattened.fontSize) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
flattened.fontSize = flattened.fontSize * fonts.scaleMultiplier
|
flattened.fontSize = Math.round(
|
||||||
|
// @ts-ignore
|
||||||
|
flattened.fontSize * fonts.scaleMultiplier,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const shared = {
|
const shared = {
|
||||||
uiTextView: true,
|
uiTextView: selectable && isIOS,
|
||||||
selectable,
|
selectable,
|
||||||
style: flattened,
|
style: flattened,
|
||||||
|
dataSet: Object.assign({tooltip: title}, dataSet || {}),
|
||||||
...props,
|
...props,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return shared
|
||||||
|
}, [
|
||||||
|
dataSet,
|
||||||
|
fonts.family,
|
||||||
|
fonts.scaleMultiplier,
|
||||||
|
lineHeightStyle,
|
||||||
|
props,
|
||||||
|
selectable,
|
||||||
|
style,
|
||||||
|
title,
|
||||||
|
typography,
|
||||||
|
])
|
||||||
|
|
||||||
|
if (selectable && isIOS) {
|
||||||
return (
|
return (
|
||||||
<UITextView {...shared}>
|
<UITextView {...textProps}>
|
||||||
{isIOS && emoji ? renderChildrenWithEmoji(children, shared) : children}
|
{isIOS && emoji
|
||||||
|
? renderChildrenWithEmoji(children, textProps)
|
||||||
|
: children}
|
||||||
</UITextView>
|
</UITextView>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const flattened = StyleSheet.flatten([
|
|
||||||
s.black,
|
|
||||||
typography,
|
|
||||||
lineHeightStyle,
|
|
||||||
style,
|
|
||||||
])
|
|
||||||
|
|
||||||
applyFonts(flattened, fonts.family)
|
|
||||||
|
|
||||||
// should always be defined on `typography`
|
|
||||||
// @ts-ignore
|
|
||||||
if (flattened.fontSize) {
|
|
||||||
// @ts-ignore
|
|
||||||
flattened.fontSize = flattened.fontSize * fonts.scaleMultiplier
|
|
||||||
}
|
|
||||||
|
|
||||||
const shared = {
|
|
||||||
selectable,
|
|
||||||
style: flattened,
|
|
||||||
dataSet: Object.assign({tooltip: title}, dataSet || {}),
|
|
||||||
...props,
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RNText {...shared}>
|
<RNText {...textProps}>
|
||||||
{isIOS && emoji ? renderChildrenWithEmoji(children, shared) : children}
|
{isIOS && emoji ? renderChildrenWithEmoji(children, textProps) : children}
|
||||||
</RNText>
|
</RNText>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user