Skip to content

Commit

Permalink
moving logic to javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
fabOnReact committed Feb 9, 2022
1 parent c263d93 commit 6ab7ab3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
13 changes: 12 additions & 1 deletion Libraries/Text/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,20 @@ const Text: React.AbstractComponent<

const [isHighlighted, setHighlighted] = useState(false);

const _disabled =
restProps.disabled != null
? restProps.disabled
: props.accessibilityState?.disabled;
const _accessibilityState =
_disabled !== props.accessibilityState?.disabled
? {...props.accessibilityState, disabled: _disabled}
: props.accessibilityState;

const isPressable =
(onPress != null ||
onLongPress != null ||
onStartShouldSetResponder != null) &&
restProps.disabled !== true;
_disabled !== true;

const initialized = useLazyInitialization(isPressable);
const config = useMemo(
Expand Down Expand Up @@ -174,7 +183,9 @@ const Text: React.AbstractComponent<
<NativeText
{...restProps}
{...eventHandlersForText}
disabled={_disabled}
accessible={accessible !== false}
accessibilityState={_accessibilityState}
allowFontScaling={allowFontScaling !== false}
ellipsizeMode={ellipsizeMode ?? 'tail'}
isHighlighted={isHighlighted}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ public abstract class ReactTextAnchorViewManager<T extends View, C extends React
};
private static final String TAG = "ReactTextAnchorViewManager";

@ReactProp(name = "accessible")
public void setAccessible(ReactTextView view, boolean accessible) {
view.setFocusable(accessible);
}

// maxLines can only be set in master view (block), doesn't really make sense to set in a span
@ReactProp(name = ViewProps.NUMBER_OF_LINES, defaultInt = ViewDefaults.NUMBER_OF_LINES)
public void setNumberOfLines(ReactTextView view, int numberOfLines) {
Expand Down

0 comments on commit 6ab7ab3

Please sign in to comment.