@@ -21,6 +21,7 @@ import 'package:react/src/react_client/private_utils.dart' show validateJsApiThe
21
21
22
22
export 'package:react/src/context.dart' ;
23
23
export 'package:react/src/prop_validator.dart' ;
24
+ export 'package:react/src/react_client/event_helpers.dart' ;
24
25
export 'package:react/react_client/react_interop.dart' show forwardRef, forwardRef2, createRef, memo, memo2;
25
26
26
27
typedef Error PropValidator <TProps >(TProps props, PropValidatorInfo info);
@@ -1433,6 +1434,10 @@ class NotSpecified {
1433
1434
const NotSpecified ();
1434
1435
}
1435
1436
1437
+ const _syntheticEventDeprecationMessagePrefix = 'Creating events via constructors is no longer supported. ' ;
1438
+ const _syntheticEventDeprecationMessagePostfix =
1439
+ 'Alternatively, use the `Simulate` test APIs to create events in testing environments.' ;
1440
+
1436
1441
/// A cross-browser wrapper around the browser's [nativeEvent] .
1437
1442
///
1438
1443
/// It has the same interface as the browser's native event, including [stopPropagation] and [preventDefault] , except
@@ -1584,6 +1589,9 @@ class SyntheticEvent {
1584
1589
/// See: <https://developer.mozilla.org/en-US/docs/Web/API/Event/type>
1585
1590
final String type;
1586
1591
1592
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1593
+ 'Use `createSyntheticEvent` instead. ' +
1594
+ _syntheticEventDeprecationMessagePostfix)
1587
1595
SyntheticEvent (
1588
1596
this .bubbles,
1589
1597
this .cancelable,
@@ -1602,6 +1610,9 @@ class SyntheticEvent {
1602
1610
class SyntheticClipboardEvent extends SyntheticEvent {
1603
1611
final clipboardData;
1604
1612
1613
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1614
+ 'Use `createSyntheticClipboardEvent` instead. ' +
1615
+ _syntheticEventDeprecationMessagePostfix)
1605
1616
SyntheticClipboardEvent (
1606
1617
bool bubbles,
1607
1618
bool cancelable,
@@ -1633,6 +1644,9 @@ class SyntheticKeyboardEvent extends SyntheticEvent {
1633
1644
final num keyCode;
1634
1645
final num charCode;
1635
1646
1647
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1648
+ 'Use `createSyntheticKeyboardEvent` instead. ' +
1649
+ _syntheticEventDeprecationMessagePostfix)
1636
1650
SyntheticKeyboardEvent (
1637
1651
bool bubbles,
1638
1652
bool cancelable,
@@ -1664,6 +1678,9 @@ class SyntheticKeyboardEvent extends SyntheticEvent {
1664
1678
class SyntheticCompositionEvent extends SyntheticEvent {
1665
1679
final String data;
1666
1680
1681
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1682
+ 'Use `createSyntheticCompositionEvent` instead. ' +
1683
+ _syntheticEventDeprecationMessagePostfix)
1667
1684
SyntheticCompositionEvent (
1668
1685
bool bubbles,
1669
1686
bool cancelable,
@@ -1685,6 +1702,9 @@ class SyntheticCompositionEvent extends SyntheticEvent {
1685
1702
class SyntheticFocusEvent extends SyntheticEvent {
1686
1703
final /*DOMEventTarget*/ relatedTarget;
1687
1704
1705
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1706
+ 'Use `createSyntheticFocusEvent` instead. ' +
1707
+ _syntheticEventDeprecationMessagePostfix)
1688
1708
SyntheticFocusEvent (
1689
1709
bool bubbles,
1690
1710
bool cancelable,
@@ -1704,6 +1724,9 @@ class SyntheticFocusEvent extends SyntheticEvent {
1704
1724
}
1705
1725
1706
1726
class SyntheticFormEvent extends SyntheticEvent {
1727
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1728
+ 'Use `createSyntheticFormEvent` instead. ' +
1729
+ _syntheticEventDeprecationMessagePostfix)
1707
1730
SyntheticFormEvent (
1708
1731
bool bubbles,
1709
1732
bool cancelable,
@@ -1746,6 +1769,9 @@ class SyntheticMouseEvent extends SyntheticEvent {
1746
1769
final num screenY;
1747
1770
final bool shiftKey;
1748
1771
1772
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1773
+ 'Use `createSyntheticMouseEvent` instead. ' +
1774
+ _syntheticEventDeprecationMessagePostfix)
1749
1775
SyntheticMouseEvent (
1750
1776
bool bubbles,
1751
1777
bool cancelable,
@@ -1789,6 +1815,9 @@ class SyntheticPointerEvent extends SyntheticEvent {
1789
1815
final String pointerType;
1790
1816
final bool isPrimary;
1791
1817
1818
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1819
+ 'Use `createSyntheticPointerEvent` instead. ' +
1820
+ _syntheticEventDeprecationMessagePostfix)
1792
1821
SyntheticPointerEvent (
1793
1822
bool bubbles,
1794
1823
bool cancelable,
@@ -1825,6 +1854,9 @@ class SyntheticTouchEvent extends SyntheticEvent {
1825
1854
final /*DOMTouchList*/ targetTouches;
1826
1855
final /*DOMTouchList*/ touches;
1827
1856
1857
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1858
+ 'Use `createSyntheticTouchEvent` instead. ' +
1859
+ _syntheticEventDeprecationMessagePostfix)
1828
1860
SyntheticTouchEvent (
1829
1861
bool bubbles,
1830
1862
bool cancelable,
@@ -1854,6 +1886,9 @@ class SyntheticTransitionEvent extends SyntheticEvent {
1854
1886
final num elapsedTime;
1855
1887
final String pseudoElement;
1856
1888
1889
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1890
+ 'Use `createSyntheticTransitionEvent` instead. ' +
1891
+ _syntheticEventDeprecationMessagePostfix)
1857
1892
SyntheticTransitionEvent (
1858
1893
bubbles,
1859
1894
cancelable,
@@ -1879,6 +1914,9 @@ class SyntheticAnimationEvent extends SyntheticEvent {
1879
1914
final num elapsedTime;
1880
1915
final String pseudoElement;
1881
1916
1917
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1918
+ 'Use `createSyntheticAnimationEvent` instead. ' +
1919
+ _syntheticEventDeprecationMessagePostfix)
1882
1920
SyntheticAnimationEvent (
1883
1921
bubbles,
1884
1922
cancelable,
@@ -1903,6 +1941,9 @@ class SyntheticUIEvent extends SyntheticEvent {
1903
1941
final num detail;
1904
1942
final /*DOMAbstractView*/ view;
1905
1943
1944
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1945
+ 'Use `createSyntheticUIEvent` instead. ' +
1946
+ _syntheticEventDeprecationMessagePostfix)
1906
1947
SyntheticUIEvent (
1907
1948
bool bubbles,
1908
1949
bool cancelable,
@@ -1928,6 +1969,9 @@ class SyntheticWheelEvent extends SyntheticEvent {
1928
1969
final num deltaY;
1929
1970
final num deltaZ;
1930
1971
1972
+ @Deprecated (_syntheticEventDeprecationMessagePrefix +
1973
+ 'Use `createSyntheticWheelEvent` instead. ' +
1974
+ _syntheticEventDeprecationMessagePostfix)
1931
1975
SyntheticWheelEvent (
1932
1976
bool bubbles,
1933
1977
bool cancelable,
0 commit comments