re-render on numberOfLines change
This commit is contained in:
@@ -34,10 +34,15 @@ public class ExpoUITextViewModule: Module {
|
||||
Prop("allowFontScaling") { (view: ExpoUITextView, prop: Bool) in
|
||||
view.textView.adjustsFontForContentSizeCategory = prop
|
||||
}
|
||||
Prop("numberOfLines") { (view: ExpoUITextView, prop: Int) in
|
||||
view.textView.textContainer.maximumNumberOfLines = prop
|
||||
Prop("numberOfLines") { (view: ExpoUITextView, prop: Int?) in
|
||||
view.textView.textContainer.maximumNumberOfLines = prop ?? 0
|
||||
|
||||
if view.textView.attributedText != nil {
|
||||
view.setText()
|
||||
}
|
||||
}
|
||||
Prop("ellipsizeMode") { (view: ExpoUITextView, prop: EllipsizeMode) in
|
||||
print(prop.toLineBreakMode())
|
||||
view.textView.textContainer.lineBreakMode = prop.toLineBreakMode()
|
||||
}
|
||||
Prop("selectable") { (view: ExpoUITextView, prop: Bool) in
|
||||
|
||||
@@ -22,7 +22,6 @@ const useTextAncestorContext = () => React.useContext(TextAncestorContext)
|
||||
const textDefaults: TextProps = {
|
||||
allowFontScaling: true,
|
||||
selectable: true,
|
||||
lineBreakMode: 'tail',
|
||||
}
|
||||
|
||||
export default function ExpoUITextView({
|
||||
@@ -45,6 +44,7 @@ export default function ExpoUITextView({
|
||||
<ExpoUITextViewRoot
|
||||
{...textDefaults}
|
||||
{...rest}
|
||||
ellipsizeMode={rest.ellipsizeMode ?? rest.lineBreakMode ?? 'tail'}
|
||||
style={[{flex: 1}, rootStyle]}>
|
||||
{React.Children.toArray(children).map((c, index) => {
|
||||
if (React.isValidElement(c)) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import {TextProps, TextStyle, ViewStyle} from 'react-native'
|
||||
|
||||
export interface ExpoUITextViewProps extends TextProps {}
|
||||
|
||||
export interface ExpoUITextViewNativeProps {
|
||||
export interface ExpoUITextViewNativeProps extends TextProps {
|
||||
children: React.ReactNode
|
||||
style: ViewStyle[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user