Skip to content

When highlighting occurs, UI changes are bugged #9

@Douglas-Hsieh

Description

@Douglas-Hsieh

Hello, thank you for fixing the overlay flickering :)

I found another issue: When highlighting occurs, UI changes are bugged.

In this repro, changing the screens will work, but will stop working once highlighting occurs.

import React, { useState } from 'react';
import { Button } from 'react-native';
import { HighlightableElement, HighlightableElementProvider, HighlightOverlay } from 'react-native-highlight-overlay';

export default function App() {

  const [highlightId, setHighlightId] = useState<string>()
  const [screen, setScreen] = useState<string>('screen1')

  return (
    <HighlightableElementProvider>
      { screen === 'screen1' &&
        <HighlightableElement id="button1">
          <Button title={'button1'} onPress={() => {
            if (highlightId) {
              setHighlightId(null)
            } else {
              setHighlightId('button1')
            }
          }}/>
        </HighlightableElement>
      }

      { screen === 'screen2' &&
        <HighlightableElement id="button2">
          <Button title={'button2'} onPress={() => {
            if (highlightId) {
              setHighlightId(null)
            } else {
              setHighlightId('button2')
            }
          }}/>
        </HighlightableElement>
      }

      <Button title={'Change Screen'} onPress={() => {
        if (screen === 'screen1') {
          setScreen('screen2')
        } else {
          setScreen('screen1')
        }
      }}/>

      <HighlightOverlay
        highlightedElementId={highlightId}
        onDismiss={() => {}}
      />
    </HighlightableElementProvider>
  )
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions