Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ReactNativeFiber event handling regression #8959

Merged
merged 3 commits into from
Feb 9, 2017

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Feb 8, 2017

Fixed event handling regression introduced in b354db2 and added test coverage to ReactNativeEvents-test for fiber.

Also added test coverage to ReactNativeEvents-test for Fiber
Copy link
Collaborator

@sophiebits sophiebits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code change looks good but how does this make us use Fiber in the test?

@bvaughn
Copy link
Contributor Author

bvaughn commented Feb 8, 2017

The code change looks good but how does this make us use Fiber in the test?

The test now mocks ReactNative and the mock observes the feature flag unlike the actual ReactNative.

@sophiebits
Copy link
Collaborator

Got it, but that's false in the repo right?

Let's mock RN always:

jest.mock('ReactDOM');

but it seems like we should also make that depend on the feature flag by adding a ReactNativeFeatureFlags mock in the same file. Can you do that?

Brian Vaughn added 2 commits February 8, 2017 14:11
Updated the test-framework-setup file so that record-tests runs native tests against ReactNativeFiber. ReactComponentTreeHook native tests all now fail but that's expected.
@@ -45,17 +47,17 @@ describe('ReactNative', () => {

ReactNative.render(<View foo="foo" />, 11);

expect(UIManager.createView.mock.calls.length).toBe(2);
expect(UIManager.setChildren.mock.calls.length).toBe(2);
expect(UIManager.createView.mock.calls.length).toBe(1);
Copy link
Collaborator

@sebmarkbage sebmarkbage Feb 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see changes to this test but no changes to how stack works. So how did this pass before vs. now? EDIT: Oh nvm. I get it. This used to be dependent on module state between resets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. Noticed this when fit() running the test.

if (parentInstance._children.length === 0) {
return false;
}

// Map from child objects to native tags.
// Either way we need to pass a copy of the Array to prevent it from being frozen.
const nativeTags = parentInstance._children.map(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated: There's some slow paths here that we should look into optimizing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants