-
Notifications
You must be signed in to change notification settings - Fork 58
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
FED-1729 Prepare for react-dart 7.0.0 #846
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a5a0f83
Add internal copy of forwardRef, removed from react-dart 7.0.0
greglittlefield-wf b426270
Remove tests that rely on jsThis being null in unmounted components
greglittlefield-wf 028ff4d
Reuse jsifyPropTypes super logic to avoid reimplementing JS interop
greglittlefield-wf 1844351
Remove unused import
greglittlefield-wf ab42a4d
Fix invalid_override_different_default_values_positional warning w/ r…
greglittlefield-wf b6d6d10
Bump lower bound of react to version that adds htmlMain
greglittlefield-wf 1a6161a
Add useRefInit
greglittlefield-wf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
import 'dart:js_util'; | ||
|
||
import 'package:js/js.dart'; | ||
import 'package:meta/meta.dart'; | ||
import 'package:react/react_client/component_factory.dart'; | ||
import 'package:react/react_client/js_backed_map.dart'; | ||
import 'package:react/react_client/js_interop_helpers.dart'; | ||
import 'package:react/react_client/react_interop.dart'; | ||
import 'package:react/react_client/zone.dart'; | ||
|
||
/// A copy of the `forwardRef` function that was removed from react-dart in 7.0.0, | ||
/// but is still needed by the deprecated `forwardRef` in over_react. | ||
/// | ||
/// We'll remove this copy once we remove over_react's forwardRef in the next major. | ||
@internal | ||
ReactJsComponentFactoryProxy forwardRef( | ||
Function(Map props, Ref ref) wrapperFunction, { | ||
String displayName = 'Anonymous', | ||
}) { | ||
// ignore: invalid_use_of_visible_for_testing_member | ||
final wrappedComponent = allowInterop((JsMap props, ref) => componentZone.run(() { | ||
final dartProps = JsBackedMap.backedBy(props); | ||
for (final value in dartProps.values) { | ||
if (value is Function) { | ||
// Tag functions that came straight from the JS | ||
// so that we know to pass them through as-is during prop conversion. | ||
isRawJsFunctionFromProps[value] = true; | ||
} | ||
} | ||
|
||
final dartRef = Ref.fromJs(ref as JsRef); | ||
return wrapperFunction(dartProps, dartRef); | ||
})); | ||
defineProperty(wrappedComponent, 'displayName', JsPropertyDescriptor(value: displayName)); | ||
|
||
final hoc = React.forwardRef(wrappedComponent); | ||
// ignore: invalid_use_of_protected_member | ||
setProperty(hoc, 'dartComponentVersion', ReactDartComponentVersion.component2); | ||
|
||
return ReactJsComponentFactoryProxy(hoc, alwaysReturnChildrenAsList: true); | ||
} | ||
|
||
@JS() | ||
@anonymous | ||
class JsPropertyDescriptor { | ||
external factory JsPropertyDescriptor({dynamic value}); | ||
} | ||
|
||
@JS('Object.defineProperty') | ||
external void defineProperty(dynamic object, String propertyName, JsPropertyDescriptor descriptor); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏅