Skip to content

Fabric Interop - Properly dispatch integer commands - #38527

Closed
cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D47600094
Closed

Fabric Interop - Properly dispatch integer commands#38527
cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D47600094

Conversation

@cortinico

Copy link
Copy Markdown
Contributor

Summary:
This fixes a bug that got reported for the Fabric Interop for Android with Command dispatching.
(See terrylinla/react-native-sketch-canvas#236)

The problem is that libraries that were receiving commands as ints with:

public void receiveCommand(
int surfaceId, int reactTag, int commandId, Nullable ReadableArray commandArgs) {

would not receive command with the Fabric Interop for Android.

The problem is that with Fabric, events are dispatched as string always.
cipolleschi took care of this for iOS, but we realized that the Android part was missing. I'm adding it here.

The logic is, if the event is dispatched as a string that represents a number (say "42") and the user has Fabric Interop enabled, then we dispatch the event as int (so libraries will keep on working).

Changelog:
[Android] [Fixed] - Fabric Interop - Properly dispatch integer commands

Differential Revision: D47600094

@facebook-github-botfacebook-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. p: Facebook Partner: Facebook Partner fb-exported labels Jul 20, 2023
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D47600094

@github-actionsgithub-actionsBot added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Jul 20, 2023
@cortinicocortinico removed the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Jul 20, 2023
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D47600094

@github-actionsgithub-actionsBot added the Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. label Jul 20, 2023
@analysis-bot

analysis-bot commented Jul 20, 2023

Copy link
Copy Markdown
PlatformEngineArchSize (bytes)Diff
androidhermesarm64-v8a8,843,281-540
androidhermesarmeabi-v7a8,152,419-528
androidhermesx869,349,045-544
androidhermesx86_649,191,799-540
androidjscarm64-v8a9,456,009+424
androidjscarmeabi-v7a8,637,140+417
androidjscx869,539,094+418
androidjscx86_649,782,387+413

Base commit: f6197cd
Branch: main

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D47600094

Summary:
Pull Request resolved: react#38527
This fixes a bug that got reported for the Fabric Interop for Android with Command dispatching.
(See terrylinla/react-native-sketch-canvas#236)
The problem is that libraries that were receiving commands as ints with:
```
public void receiveCommand(
int surfaceId, int reactTag, int commandId, Nullable ReadableArray commandArgs) {
```
would not receive command with the Fabric Interop for Android.
The problem is that with Fabric, events are dispatched as string always.
cipolleschi took care of this for iOS, but we realized that the Android part was missing. I'm adding it here.
The logic is, if the event is dispatched as a string that represents a number (say `"42"`) and the user has Fabric Interop enabled, then we dispatch the event as `int` (so libraries will keep on working).
Changelog:
[Android] [Fixed] - Fabric Interop - Properly dispatch integer commands
Reviewed By: cipolleschi
Differential Revision: D47600094
fbshipit-source-id: adb789abc529b9b1aa0dfcf979ac16856a31135d
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D47600094

@github-actions

Copy link
Copy Markdown

This pull request was successfully merged by @cortinico in ccc50dd.

When will my fix make it into a release? | Upcoming Releases

@github-actionsgithub-actionsBot added the Merged This PR has been merged. label Jul 21, 2023
cortinico added a commit that referenced this pull request Aug 8, 2023
Summary:
Pull Request resolved: #38527
This fixes a bug that got reported for the Fabric Interop for Android with Command dispatching.
(See terrylinla/react-native-sketch-canvas#236)
The problem is that libraries that were receiving commands as ints with:
```
public void receiveCommand(
int surfaceId, int reactTag, int commandId, Nullable ReadableArray commandArgs) {
```
would not receive command with the Fabric Interop for Android.
The problem is that with Fabric, events are dispatched as string always.
cipolleschi took care of this for iOS, but we realized that the Android part was missing. I'm adding it here.
The logic is, if the event is dispatched as a string that represents a number (say `"42"`) and the user has Fabric Interop enabled, then we dispatch the event as `int` (so libraries will keep on working).
Changelog:
[Android] [Fixed] - Fabric Interop - Properly dispatch integer commands
Reviewed By: cipolleschi
Differential Revision: D47600094
fbshipit-source-id: c35f0509e6c6c0cddc7090a069882f92dd95532e
Kudo pushed a commit to expo/react-native that referenced this pull request Aug 21, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.fb-exportedMergedThis PR has been merged.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.p: FacebookPartner: FacebookPartner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@cortinico@facebook-github-bot@analysis-bot