Skip to content

Expose ReactDelegate for react-native-restart - #43588

Closed
arushikesarwani94 wants to merge 1 commit into
react:mainfrom
arushikesarwani94:export-D55166962
Closed

Expose ReactDelegate for react-native-restart#43588
arushikesarwani94 wants to merge 1 commit into
react:mainfrom
arushikesarwani94:export-D55166962

Conversation

@arushikesarwani94

Copy link
Copy Markdown
Contributor

Summary:
Supported reload() in Bridgeless through ReactDelegate in #43521 in order to unblock react-native-restart

https://github.com/avishayil/react-native-restart/blob/134cabd5b3f355ffe551e5dd1be1dd46d870fe13/android/src/main/java/com/reactnativerestart/RestartModule.java#L54

which can access React Delegate through :

if(currentActivity instanceof ReactActivity) {
ReactActivity reactActivity = (ReactActivity) currentActivity;
ReactDelegate reactDelegate = reactActivity.getReactDelegate();
reactDelegate.reload()
}

Changelog:
[Android][Added] Expose ReactDelegate in ReactActivity

Differential Revision: D55166962

@facebook-github-botfacebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 21, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

Summary:
Supported `reload()` in Bridgeless through ReactDelegate in react#43521 in order to unblock react-native-restart
https://github.com/avishayil/react-native-restart/blob/134cabd5b3f355ffe551e5dd1be1dd46d870fe13/android/src/main/java/com/reactnativerestart/RestartModule.java#L54
which can access React Delegate through :
```
if(currentActivity instanceof ReactActivity) {
ReactActivity reactActivity = (ReactActivity) currentActivity;
ReactDelegate reactDelegate = reactActivity.getReactDelegate();
reactDelegate.reload()
}
```
Changelog:
[Android][Added] Expose ReactDelegate in ReactActivity
Differential Revision: D55166962
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@analysis-bot

Copy link
Copy Markdown
PlatformEngineArchSize (bytes)Diff
androidhermesarm64-v8a18,093,688+7
androidhermesarmeabi-v7an/a--
androidhermesx86n/a--
androidhermesx86_64n/a--
androidjscarm64-v8a21,462,791+6
androidjscarmeabi-v7an/a--
androidjscx86n/a--
androidjscx86_64n/a--

Base commit: 0267ca0
Branch: main

@facebook-github-botfacebook-github-bot added the Merged This PR has been merged. label Mar 21, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in 62ebe55.

cortinico pushed a commit that referenced this pull request Mar 25, 2024
Summary:
Pull Request resolved: #43588
Supported `reload()` in Bridgeless through ReactDelegate in #43521 in order to unblock react-native-restart
https://github.com/avishayil/react-native-restart/blob/134cabd5b3f355ffe551e5dd1be1dd46d870fe13/android/src/main/java/com/reactnativerestart/RestartModule.java#L54
which can access React Delegate through :
```
if(currentActivity instanceof ReactActivity) {
ReactActivity reactActivity = (ReactActivity) currentActivity;
ReactDelegate reactDelegate = reactActivity.getReactDelegate();
reactDelegate.reload()
}
```
Changelog:
[Android][Added] Expose ReactDelegate in ReactActivity
Reviewed By: cortinico
Differential Revision: D55166962
fbshipit-source-id: 5d8dfd7ad61edbcb5233014800eb66a538842ca5
arushikesarwani94 added a commit to arushikesarwani94/react-native that referenced this pull request Mar 26, 2024
Summary:
react#43521 & react#43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless.
Adding implementation of `DisabledDevSupportManager.handleReloadJS()` won't work as it would mean introducing circular dependency `devsupport` -> `runtime`
Reviewed By: cortinico
Differential Revision: D55342296
facebook-github-bot pushed a commit that referenced this pull request Mar 27, 2024
Summary:
Pull Request resolved: #43645#43521 & #43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless.
Adding implementation of `DisabledDevSupportManager.handleReloadJS()` won't work as it would mean introducing circular dependency `devsupport` -> `runtime`
Reviewed By: cortinico
Differential Revision: D55342296
fbshipit-source-id: ee6fba68586a2bdd1163522f75e6beb1b7736f6c
huntie pushed a commit that referenced this pull request Apr 2, 2024
Summary:
Pull Request resolved: #43645#43521 & #43588 aimed to fix `react-native-restart`, however in release `handleReloadJS()` is a no-op in [DisabledDevSupportManager](https://github.com/facebook/react-native/blob/ac714b1c3300d3a169bdcfec05d556e18a7b83ff/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java#L139) which is why this should not work. Fixing it by relying on `ReactHostImpl.reload()` instead for Bridgeless.
Adding implementation of `DisabledDevSupportManager.handleReloadJS()` won't work as it would mean introducing circular dependency `devsupport` -> `runtime`
Reviewed By: cortinico
Differential Revision: D55342296
fbshipit-source-id: ee6fba68586a2bdd1163522f75e6beb1b7736f6c
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.p: FacebookPartner: FacebookPartner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@arushikesarwani94@facebook-github-bot@analysis-bot