Skip to content

Commit 136d522

Browse files
Merge pull request #420 from Workiva/release-over-react-3.1.3
RM-61380 Release over_react 3.1.3 (Allow UiComponent2 to subtype UiComponent)
2 parents d7d57fd + 8dcfb74 commit 136d522

File tree

8 files changed

+405
-2
lines changed

8 files changed

+405
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# OverReact Changelog
22

3+
## [3.1.3](https://github.com/Workiva/over_react/compare/3.1.2...3.1.3)
4+
5+
- Fixes an issue that prevents `UiComponent` instances from being declared as sub-types of `UiComponent2` instances
6+
via the `subtypeOf` argument in a `Component2()` annotation.
7+
38
## [3.1.2](https://github.com/Workiva/over_react/compare/3.1.1...3.1.2)
49

510
- Restore the public `getPropKey` function that was accidentally made private in the 3.1.0 release.

lib/src/component_declaration/component_base_2.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ ReactDartComponentFactoryProxy2 registerAbstractComponent2(Type abstractComponen
5454
/// * [displayName]: the name of the component for use when debugging.
5555
ReactDartComponentFactoryProxy2 registerComponent2(react.Component2 Function() dartComponentFactory, {
5656
bool isWrapper = false,
57-
ReactDartComponentFactoryProxy2 parentType,
57+
// This must remain typed in a way that both UiComponent and UiComponent2 classes can be passed as the `subtypeOf` value.
58+
ReactDartComponentFactoryProxy parentType,
5859
UiFactory builderFactory,
5960
Type componentClass,
6061
String displayName,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: over_react
2-
version: 3.1.2
2+
version: 3.1.3
33
description: A library for building statically-typed React UI components using Dart.
44
homepage: https://github.com/Workiva/over_react/
55
authors:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2019 Workiva Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import 'package:over_react/over_react.dart';
16+
import './subtype_of_component1.dart';
17+
18+
part 'subsubtype_of_component1.over_react.g.dart';
19+
20+
@Factory()
21+
UiFactory<TestSubsubtypeOfComponent1Props> TestSubsubtypeOfComponent1 = _$TestSubsubtypeOfComponent1;
22+
23+
@Props()
24+
class _$TestSubsubtypeOfComponent1Props extends UiProps {}
25+
26+
@Component2(subtypeOf: TestSubtypeOfComponent1Component)
27+
class TestSubsubtypeOfComponent1Component extends UiComponent2<TestSubsubtypeOfComponent1Props> {
28+
@override
29+
render() => Dom.div()();
30+
}

test/over_react/component_declaration/component2_type_checking_test/type_inheritance/subsubtype_of_component1.over_react.g.dart

Lines changed: 159 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2019 Workiva Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import 'package:over_react/over_react.dart';
16+
17+
import '../../component_type_checking_test/type_inheritance/parent.dart';
18+
19+
part 'subtype_of_component1.over_react.g.dart';
20+
21+
@Factory()
22+
UiFactory<TestSubtypeOfComponent1Props> TestSubtypeOfComponent1 = _$TestSubtypeOfComponent1;
23+
24+
@Props()
25+
class _$TestSubtypeOfComponent1Props extends UiProps {}
26+
27+
@Component2(subtypeOf: TestParentComponent)
28+
class TestSubtypeOfComponent1Component extends UiComponent2<TestSubtypeOfComponent1Props> {
29+
@override
30+
render() => Dom.div()();
31+
}

0 commit comments

Comments
 (0)