Skip to content

Conversation

@chewy444
Copy link
Contributor

@chewy444 chewy444 commented Dec 23, 2019

Motivation

Increase accessibility of Appbar.Content by adding support for Accessibilityinfo.setaccessibilityfocus allowing apps to focus screen readers on the Appbar.Content title when a screen is initially rendered.

Notes: Android requires the focused component to have accessible set in order to focus.

Example:

const FocusedHeader = () => {
  const ref = useRef<Text>(null);

  useEffect(() => {
    const handle = findNodeHandle(ref.current);
    AccessibilityInfo.setAccessibilityFocus(handle);
  });

  return (
    <Appbar.Header>
      <Appbar.Content
        titleRef={ref}
        title="Screen Title"
      />
    </Appbar.Header>
  );
};

Test plan

yarn flow && yarn typescript && yarn lint && yarn test

@callstack-bot
Copy link

Hey @chewy444, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@Trancever Trancever requested a review from satya164 January 8, 2020 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants