@@ -22,7 +22,7 @@ export 'package:react/src/react_client/factory_util.dart' show generateJsProps;
22
22
/// Currently only involves converting a top-level non-[List] [Iterable] to
23
23
/// a non-growable [List] , but this may be updated in the future to support
24
24
/// advanced nesting and other kinds of children.
25
- dynamic listifyChildren (dynamic children) {
25
+ ReactNode listifyChildren (ReactNode children) {
26
26
if (React .isValidElement (children)) {
27
27
// Short-circuit if we're dealing with a ReactElement to avoid the dart2js
28
28
// interceptor lookup involved in Dart type-checking.
@@ -63,7 +63,7 @@ Map unconvertJsProps(/* ReactElement|ReactComponent */ instance) {
63
63
/// Shared component factory proxy [build] method for components that utilize [JsBackedMap] s.
64
64
mixin JsBackedMapComponentFactoryMixin on ReactComponentFactoryProxy {
65
65
@override
66
- ReactElement build (Map props, [List childrenArgs = const []]) {
66
+ ReactElement build (Map props, [List < ReactNode > childrenArgs = const []]) {
67
67
final children = generateChildren (childrenArgs, shouldAlwaysBeList: true );
68
68
final convertedProps = generateExtendedJsProps (props);
69
69
return React .createElement (type, convertedProps, children);
@@ -89,7 +89,7 @@ class ReactDartComponentFactoryProxy<TComponent extends Component> extends React
89
89
ReactClass get type => reactClass;
90
90
91
91
@override
92
- ReactElement build (Map props, [List childrenArgs = const []]) {
92
+ ReactElement build (Map props, [List < ReactNode > childrenArgs = const []]) {
93
93
var children = convertArgsToChildren (childrenArgs);
94
94
children = listifyChildren (children);
95
95
@@ -98,7 +98,7 @@ class ReactDartComponentFactoryProxy<TComponent extends Component> extends React
98
98
99
99
/// Returns a JavaScript version of the specified [props] , preprocessed for consumption by ReactJS and prepared for
100
100
/// consumption by the `react` library internals.
101
- static InteropProps generateExtendedJsProps (Map props, dynamic children, {Map ? defaultProps}) {
101
+ static InteropProps generateExtendedJsProps (Map props, ReactNode children, {Map ? defaultProps}) {
102
102
if (children == null ) {
103
103
children = [];
104
104
} else if (children is ! Iterable ) {
@@ -212,8 +212,8 @@ class ReactJsContextComponentFactoryProxy extends ReactJsComponentFactoryProxy {
212
212
super (jsClass, shouldConvertDomProps: shouldConvertDomProps);
213
213
214
214
@override
215
- ReactElement build (Map props, [List childrenArgs = const []]) {
216
- dynamic children = generateChildren (childrenArgs);
215
+ ReactElement build (Map props, [List < ReactNode > childrenArgs = const []]) {
216
+ var children = generateChildren (childrenArgs);
217
217
218
218
if (isConsumer) {
219
219
if (children is Function ) {
@@ -271,7 +271,7 @@ class ReactJsComponentFactoryProxy extends ReactComponentFactoryProxy {
271
271
}
272
272
273
273
@override
274
- ReactElement build (Map props, [List childrenArgs = const []]) {
274
+ ReactElement build (Map props, [List < ReactNode > childrenArgs = const []]) {
275
275
final children = generateChildren (childrenArgs, shouldAlwaysBeList: alwaysReturnChildrenAsList);
276
276
final convertedProps =
277
277
generateJsProps (props, convertCallbackRefValue: false , additionalRefPropKeys: _additionalRefPropKeys);
@@ -292,7 +292,7 @@ class ReactDomComponentFactoryProxy extends ReactComponentFactoryProxy {
292
292
String get type => name;
293
293
294
294
@override
295
- ReactElement build (Map props, [List childrenArgs = const []]) {
295
+ ReactElement build (Map props, [List < ReactNode > childrenArgs = const []]) {
296
296
final children = generateChildren (childrenArgs);
297
297
final convertedProps = generateJsProps (props, convertCallbackRefValue: false , wrapWithJsify: true );
298
298
return React .createElement (type, convertedProps, children);
0 commit comments