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

[Fabric] iOS: Fixes textinput onscroll event payload #43445

Closed
wants to merge 2 commits into from

Conversation

zhongwuzw
Copy link
Contributor

@zhongwuzw zhongwuzw commented Mar 12, 2024

Summary:

Fixes #43428 . cc @cortinico .

Changelog:

[IOS] [FIXED] - [Fabric] iOS: Fixes textinput onscroll event payload

Test Plan:

    const onInputScroll = (e) => {
      if (Platform.OS !== "web") {
        const {
          nativeEvent: {
            contentOffset: { x, y },
          },
        } = e;
        console.log('onInputScroll ====', e?.nativeEvent)
      }
    };  

<TextInput
          onScroll={onInputScroll}
          // ref={inputRef}
          multiline
  />

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Mar 12, 2024
@facebook-github-bot
Copy link
Contributor

@sammy-SC has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@cortinico
Copy link
Contributor

/rebase

payload.setProperty(runtime, "layoutMeasurement", layoutMeasurement);
}

payload.setProperty(runtime, "zoomScale", textInputMetrics.zoomScale ?: 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this check needed? Isn't zoomScale always set from Objective-C?

If is isn't, wouldn't it be better to assign a default value to zoomScale?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just kept the same as Old arch

. Seems the default zoomScale should be 1.0, and we think 0 is a invalid value.

Copy link
Contributor

Choose a reason for hiding this comment

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

that's fair. Thanks for the clarification.

Copy link
Contributor

@sammy-SC sammy-SC left a comment

Choose a reason for hiding this comment

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

thank you! I just one small question but that isn't blocking.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Mar 14, 2024
@facebook-github-bot
Copy link
Contributor

@sammy-SC merged this pull request in 10d4813.

cipolleschi pushed a commit that referenced this pull request Jun 3, 2024
Summary:
Fixes #43428 . cc cortinico .

## Changelog:

[IOS] [FIXED] - [Fabric] iOS: Fixes textinput onscroll event payload

Pull Request resolved: #43445

Test Plan:
```
    const onInputScroll = (e) => {
      if (Platform.OS !== "web") {
        const {
          nativeEvent: {
            contentOffset: { x, y },
          },
        } = e;
        console.log('onInputScroll ====', e?.nativeEvent)
      }
    };

<TextInput
          onScroll={onInputScroll}
          // ref={inputRef}
          multiline
  />
```

Reviewed By: cortinico

Differential Revision: D54813378

Pulled By: sammy-SC

fbshipit-source-id: 76671fbb390c2fbc67a9c29b6c2a834ba699fff4
This was referenced Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

【iOS】The contentOffset property is missing from TextInputView's onScroll callback
4 participants