Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ We want this community to be **friendly and respectful** to each other. Please f

## Development workflow

To get started with the project, run `yarn bootsrap` in the root directory to install the required dependencies for each package:
To get started with the project, run `yarn up` in the root directory to install the required dependencies for each package:

```sh
yarn bootsrap
yarn up
```

> This project uses [`yarn`](https://classic.yarnpkg.com/) as a package manager. While it's possible to run individual commands with [`npm`](https://github.com/npm/cli), please refrain from using it, especially `npm install.` 🙅
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export const ReactNavigationPerformanceView = (props: Props) => {
);

useEffect(() => {
if (!isStack) {
if (!isStack || !stateController.isEnabled) {
return;
}
return addListener('transitionEnd', () => {
setTransitionEnded(true);
});
}, [addListener, isStack]);
}, [addListener, isStack, stateController.isEnabled]);

let shouldReportTransitionEnd = false;
if (isStack && transitionEnded && transitionEndReported.current === false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ const createAddListenerMock = () => {
describe('ReactNavigationPerformanceView', () => {
beforeEach(() => {
jest.clearAllMocks();
useStateControllerMock.mockReturnValue({
isEnabled: true,
});
});

describe('when screen is interactive on mount', () => {
Expand Down Expand Up @@ -276,4 +279,25 @@ describe('ReactNavigationPerformanceView', () => {
});
});
});

describe('when disabled', () => {
beforeEach(() => {
useStateControllerMock.mockReturnValue({
isEnabled: false,
});
});

it('does not add a listener with setState for transitionEnd', () => {
const {wrapper, triggerTransitionEnd} = mountReactNavigationPerformanceView({
renderPassName: LOADING,
interactive: true,
});

wrapper.act(() => {
triggerTransitionEnd();
});

expect(wrapper.context.navigation.addListener).not.toBeCalledWith('transitionEnd', expect.anything());
});
});
});