Skip to content
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

Upgrade to react-native-web v0.19.9 #24482

Merged
merged 142 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
f4f44ae
replace rnw fork with latest upstream
getusha Aug 11, 2023
eb51a99
remove deprecated resizeMode style
getusha Aug 11, 2023
8602d9a
replace deprecated keyboardType with inputMode prop
getusha Aug 11, 2023
0c94199
replace deprecated returnKeyType with enterKeyHint prop
getusha Aug 12, 2023
033d72b
replace deprecated editable with readOnly prop
getusha Aug 12, 2023
6290c69
replace deprecated numberOfLines with rows TextInput
getusha Aug 12, 2023
822efb5
replace deprecated nativeID with id
getusha Aug 12, 2023
465f0a8
replace deprecated focusable with tabIndex prop
getusha Aug 12, 2023
93f060c
replace deprecated pointerEvents prop with pointerEvents style
getusha Aug 12, 2023
a3bfc89
replace deprecated accessibilityRole with role prop and adjust values
getusha Aug 12, 2023
a0bdde8
replace deprecated accessibilityLabel with aria-label prop
getusha Aug 12, 2023
55fd034
replace deprecated accessibilityLabel with aria-label prop
getusha Aug 12, 2023
6c20ce6
replace deprecated accessibilityState with arial-*
getusha Aug 12, 2023
6079901
replace deprecated selectable prop with userSelect style
getusha Aug 12, 2023
ee8f268
replace deprecated textAlignVertical prop with verticalAlign style
getusha Aug 12, 2023
ad265d3
replace array transform with spaced values
getusha Aug 12, 2023
a549f6d
fix unresponsive input
getusha Aug 12, 2023
f1a7649
make text position static and assign text to semantic tag
getusha Aug 12, 2023
54c90ce
use accessibilityLabel instead of arial-label for testing-library sup…
getusha Aug 12, 2023
17679f7
fix typo
getusha Aug 12, 2023
523e561
patch Fix inverted flatlist and other fixes
getusha Aug 13, 2023
ecaf413
remove redundant prop
getusha Aug 13, 2023
36b0f07
remove deprecated Stylesheet.compose
getusha Aug 13, 2023
6718f5e
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Aug 14, 2023
11a4196
bump react-native-key-command version to 1.0.4
getusha Aug 15, 2023
a936fe2
sync Podfile.lock with updated version
getusha Aug 15, 2023
916bff0
fix lint
getusha Aug 15, 2023
2e2727f
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Aug 15, 2023
8223ae0
fix wrong for absolute positioned elements and remove redundant patch…
getusha Aug 15, 2023
f7d6952
fix wrong alignment of emoji picker popover
getusha Aug 15, 2023
61b495c
correct isReadOnly condition
getusha Aug 15, 2023
ecdb04d
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Aug 15, 2023
76b60b9
fix lint
getusha Aug 15, 2023
3b197e5
use the correct key name
getusha Aug 15, 2023
514e99f
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Aug 16, 2023
968a37f
run prettier
getusha Aug 16, 2023
893da76
fix lint after prettier
getusha Aug 16, 2023
089cc69
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Aug 17, 2023
2c2b9f2
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Aug 18, 2023
ce97f45
remove duplicate cellRenderer
getusha Aug 18, 2023
32ebb44
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Aug 20, 2023
b339956
run prettier
getusha Aug 20, 2023
f5709f2
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Aug 21, 2023
522d7f3
fix chat content scroll view wrong alignment
getusha Aug 22, 2023
3e2b3f7
remove textAlignVertical usage accross styles
getusha Aug 22, 2023
a37dbfa
remove accessibilityRole
getusha Aug 22, 2023
17deb6d
remove redundant alias
getusha Aug 22, 2023
9895179
fic crash on Assign task
getusha Aug 23, 2023
0b4ee5c
fix unwanted freeze after navigating before transitionEnd
getusha Aug 23, 2023
5184706
fix conflic
getusha Aug 23, 2023
ff8fd42
run prettier
getusha Aug 23, 2023
02aa981
fix no space between FAB and menu
getusha Aug 23, 2023
d7a3667
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Aug 24, 2023
96151dc
fix wrong inverted list order ios
getusha Aug 25, 2023
c87e7d1
fix BackHandler is not supported on web and should not be used. error
getusha Aug 26, 2023
c61a351
replace deprecated StyleSheet.compose
getusha Aug 27, 2023
8d61c73
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Aug 27, 2023
fe84d43
remove accessibilityRole after merge
getusha Aug 27, 2023
b826fab
replace shadow* style properties with boxShadow
getusha Aug 27, 2023
11fe5b0
run prettier
getusha Aug 27, 2023
48e7300
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Sep 1, 2023
129ffd8
update package-lock
getusha Sep 1, 2023
696739a
use const value
getusha Sep 1, 2023
429c368
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Sep 10, 2023
9756b16
replace deprecated values after merging
getusha Sep 10, 2023
6b39885
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Sep 13, 2023
14b62f4
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Sep 18, 2023
e012efb
replace selectable prop with styles equivalent
getusha Sep 18, 2023
b2bd893
fix lint
getusha Sep 18, 2023
d956b64
replace deprecated props after pulling main
getusha Sep 18, 2023
f36fea0
fix typo & lint
getusha Sep 18, 2023
11d05cf
replace none-existent role value
getusha Sep 18, 2023
30e6d66
fix warning on iOS
getusha Sep 18, 2023
f1ba929
replace deprecated accessibilityRole with role prop
getusha Sep 18, 2023
3a5fb84
remove redundant CellRendererComponent
getusha Sep 19, 2023
eead447
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Sep 19, 2023
9ac00cb
run prettier
getusha Sep 19, 2023
d8a013c
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Sep 21, 2023
39e9f13
some corrections after pulling main
getusha Sep 21, 2023
53df22c
fix crashs
getusha Sep 25, 2023
e054fb9
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Sep 26, 2023
cb11d1c
fix overwritten changes from pulling main
getusha Sep 26, 2023
3c32805
replace deprecated props after pulling main
getusha Sep 26, 2023
e5c37f6
fix lint
getusha Sep 26, 2023
f7a4199
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 2, 2023
345cc42
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 2, 2023
19f03df
Correct overwritten changes back
getusha Oct 2, 2023
a688b06
Fix lint
getusha Oct 2, 2023
bbea394
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 4, 2023
7fd9eb7
Bump react-native-web version to 0.19.9
getusha Oct 4, 2023
40d3859
replace deprecated props and fix console error
getusha Oct 4, 2023
8d3b388
fix text-input focus issue and add missed changes from main
getusha Oct 4, 2023
19f45cc
run prettier
getusha Oct 4, 2023
68b64c5
fix crash when emoji list is empty
getusha Oct 6, 2023
0551c8b
remove single execution mechanism for web
getusha Oct 6, 2023
77882fd
fix wrong emojipicker alignment RHN
getusha Oct 6, 2023
03c6036
fix lint
getusha Oct 6, 2023
d5d48e0
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 6, 2023
879aa68
run prettier
getusha Oct 6, 2023
85bb0bf
fix delay of focus input after inserting emoji
getusha Oct 11, 2023
ce962a9
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 11, 2023
d56e451
replace deprecated props after pulling main
getusha Oct 11, 2023
6382489
fix lint
getusha Oct 11, 2023
8d62f3c
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 11, 2023
186efbc
Apply rnw patches
getusha Oct 13, 2023
9994159
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 13, 2023
fd50db8
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 13, 2023
0e02485
Update initialNumToRender
getusha Oct 13, 2023
502ca80
Revert Update initialNumToRender
getusha Oct 13, 2023
f49fbf1
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 19, 2023
4c66c87
style changes after ts migration
getusha Oct 19, 2023
4d76788
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 19, 2023
8c3e3bc
run prettier
getusha Oct 19, 2023
b5929dc
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 25, 2023
a49db65
Update Navigation type usage from CONST
getusha Oct 25, 2023
0a1033f
Update initialNumToRender
getusha Oct 25, 2023
3320168
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 30, 2023
ee36454
fix wrong emojipicker alignment
getusha Oct 30, 2023
d22ed89
increase mock scrollable content height for performance test
getusha Oct 30, 2023
2b8f115
replace deprecated props after pulling main
getusha Oct 30, 2023
e87d35d
Revert "Merge remote-tracking branch 'expensify/main' into upgrade-re…
getusha Oct 30, 2023
03a9fe0
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 30, 2023
71b5b31
fix lint
getusha Oct 30, 2023
8345471
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Oct 30, 2023
399309e
remove renamed component file
getusha Oct 30, 2023
e3fc7c5
fix lint and run prettier
getusha Oct 30, 2023
e6461f1
use legacy mode instead of concurrent
getusha Oct 30, 2023
dab2a9a
increase mock scrollable content height for performance test
getusha Oct 30, 2023
e6ae642
revert mock scrollable content height change for performance test
getusha Nov 3, 2023
641c2a2
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Nov 3, 2023
f26e9f4
fix delay of focus input after inserting emoji
getusha Nov 3, 2023
05ad0e8
fix wrong emojipicker alignment
getusha Nov 6, 2023
dbbacb2
increase initialNumToRender to 20
getusha Nov 6, 2023
01a9cc9
fix wrong emojipicker alignment again
getusha Nov 6, 2023
f1586ce
fix amount input showing soft keyboard
getusha Nov 6, 2023
f21576e
add default prop value to shouldUseTargetLocation
getusha Nov 6, 2023
873a227
update package-lock
getusha Nov 6, 2023
899eaf4
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Nov 6, 2023
b48a7e1
run prettier
getusha Nov 6, 2023
0aff57e
resolve conflicts
luacmartins Nov 6, 2023
1f3d2a3
Merge remote-tracking branch 'expensify/main' into upgrade-react-nati…
getusha Nov 7, 2023
c97ff97
split useSignleExecution for web and native
getusha Nov 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ const custom = require('../config/webpack/webpack.common')({
module.exports = ({config}) => {
config.resolve.alias = {
'react-native-config': 'react-web-config',
'react-native$': '@expensify/react-native-web',
'react-native-web': '@expensify/react-native-web',
'react-native$': 'react-native-web',
'@react-native-community/netinfo': path.resolve(__dirname, '../__mocks__/@react-native-community/netinfo.js'),
'@react-navigation/native': path.resolve(__dirname, '../__mocks__/@react-navigation/native'),

Expand Down
5 changes: 2 additions & 3 deletions config/webpack/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const includeModules = [
'react-native-animatable',
'react-native-reanimated',
'react-native-picker-select',
'@expensify/react-native-web',
'react-native-web',
'react-native-webview',
'@react-native-picker',
'react-native-modal',
Expand Down Expand Up @@ -185,8 +185,7 @@ const webpackConfig = ({envFile = '.env', platform = 'web'}) => ({
resolve: {
alias: {
'react-native-config': 'react-web-config',
'react-native$': '@expensify/react-native-web',
'react-native-web': '@expensify/react-native-web',
'react-native$': 'react-native-web',

// Module alias for web & desktop
// https://webpack.js.org/configuration/resolve/#resolvealias
Expand Down
16 changes: 13 additions & 3 deletions contributingGuides/FORMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,27 @@ The phone number can be formatted in different ways.

### Native Keyboards

We should always set people up for success on native platforms by enabling the best keyboard for the type of input we’re asking them to provide. See [keyboardType](https://reactnative.dev/docs/0.64/textinput#keyboardtype) in the React Native documentation.
We should always set people up for success on native platforms by enabling the best keyboard for the type of input we’re asking them to provide. See [inputMode](https://reactnative.dev/docs/textinput#inputmode) in the React Native documentation.

Comment on lines +56 to 57
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe pin the version of doc to 0.72 like this
https://reactnative.dev/docs/0.72/textinput#inputmode

We have a couple of keyboard types [defined](https://github.com/Expensify/App/blob/572caa9e7cf32a2d64fe0e93d171bb05a1dfb217/src/CONST.js#L357-L360) and should be used like so:
We have a list of input modes [defined](https://github.com/Expensify/App/blob/9418b870515102631ea2156b5ea253ee05a98ff1/src/CONST.js#L765-L774) and should be used like so:

```jsx
<InputWrapper
InputComponent={TextInput}
keyboardType={CONST.KEYBOARD_TYPE.NUMBER_PAD}
inputMode={CONST.INPUT_MODE.NUMERIC}
/>
```

We also have [keyboardType](https://github.com/Expensify/App/blob/9418b870515102631ea2156b5ea253ee05a98ff1/src/CONST.js#L760-L763) and should be used for specific use cases when there is no `inputMode` equivalent of the value exist. and should be used like so:

Comment on lines +67 to +68
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We also have [keyboardType](https://github.com/Expensify/App/blob/9418b870515102631ea2156b5ea253ee05a98ff1/src/CONST.js#L760-L763) and should be used for specific use cases when there is no `inputMode` equivalent of the value exist. and should be used like so:
We also have [keyboardType](https://reactnative.dev/docs/0.72/textinput#keyboardtype) and should be used for specific use cases when there is no `inputMode` equivalent of the value exist.
We have a couple of keyboard types [defined](https://github.com/Expensify/App/blob/9418b870515102631ea2156b5ea253ee05a98ff1/src/CONST.js#L760-L763) and should be used like so:

```jsx
<InputWrapper
InputComponent={TextInput}
keyboardType={CONST.KEYBOARD_TYPE.ASCII_CAPABLE}
/>
```


### Autofill Behavior

Forms should autofill information whenever possible i.e. they should work with browsers and password managers auto complete features.
Expand Down
73 changes: 3 additions & 70 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
},
"dependencies": {
"@dotlottie/react-player": "^1.6.3",
"@expensify/react-native-web": "0.18.15",
"@formatjs/intl-datetimeformat": "^6.10.0",
"@formatjs/intl-getcanonicallocales": "^2.2.0",
"@formatjs/intl-listformat": "^7.2.2",
Expand Down Expand Up @@ -163,6 +162,7 @@
"react-native-url-polyfill": "^2.0.0",
"react-native-view-shot": "^3.6.0",
"react-native-vision-camera": "^2.16.2",
"react-native-web": "^0.19.9",
"react-native-web-linear-gradient": "^1.1.2",
"react-native-webview": "^11.17.2",
"react-pdf": "^6.2.2",
Expand Down
59 changes: 59 additions & 0 deletions patches/eslint-plugin-react-native-a11y+3.3.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
diff --git a/node_modules/eslint-plugin-react-native-a11y/__tests__/src/rules/has-valid-accessibility-descriptors-test.js b/node_modules/eslint-plugin-react-native-a11y/__tests__/src/rules/has-valid-accessibility-descriptors-test.js
index 9ecf8b1..fef94dd 100644
--- a/node_modules/eslint-plugin-react-native-a11y/__tests__/src/rules/has-valid-accessibility-descriptors-test.js
+++ b/node_modules/eslint-plugin-react-native-a11y/__tests__/src/rules/has-valid-accessibility-descriptors-test.js
@@ -20,7 +20,7 @@ const ruleTester = new RuleTester();

const expectedError = {
message:
- 'Missing a11y props. Expected one of: accessibilityRole OR BOTH accessibilityLabel + accessibilityHint OR BOTH accessibilityActions + onAccessibilityAction',
+ 'Missing a11y props. Expected one of: accessibilityRole OR role OR BOTH accessibilityLabel + accessibilityHint OR BOTH accessibilityActions + onAccessibilityAction',
type: 'JSXOpeningElement',
};

@@ -29,6 +29,11 @@ ruleTester.run('has-valid-accessibility-descriptors', rule, {
{
code: '<View></View>;',
},
+ {
+ code: `<Pressable role="button">
+ <Text>Back</Text>
+ </Pressable>`,
+ },
{
code: `<Pressable accessibilityRole="button">
<Text>Back</Text>
diff --git a/node_modules/eslint-plugin-react-native-a11y/lib/rules/has-valid-accessibility-descriptors.js b/node_modules/eslint-plugin-react-native-a11y/lib/rules/has-valid-accessibility-descriptors.js
index 99deb91..555ebd9 100644
--- a/node_modules/eslint-plugin-react-native-a11y/lib/rules/has-valid-accessibility-descriptors.js
+++ b/node_modules/eslint-plugin-react-native-a11y/lib/rules/has-valid-accessibility-descriptors.js
@@ -16,7 +16,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
// ----------------------------------------------------------------------------
// Rule Definition
// ----------------------------------------------------------------------------
-var errorMessage = 'Missing a11y props. Expected one of: accessibilityRole OR BOTH accessibilityLabel + accessibilityHint OR BOTH accessibilityActions + onAccessibilityAction';
+var errorMessage = 'Missing a11y props. Expected one of: accessibilityRole OR role OR BOTH accessibilityLabel + accessibilityHint OR BOTH accessibilityActions + onAccessibilityAction';
var schema = (0, _schemas.generateObjSchema)();

var hasSpreadProps = function hasSpreadProps(attributes) {
@@ -35,7 +35,7 @@ module.exports = {
return {
JSXOpeningElement: function JSXOpeningElement(node) {
if ((0, _isTouchable.default)(node, context) || (0, _jsxAstUtils.elementType)(node) === 'TextInput') {
- if (!(0, _jsxAstUtils.hasAnyProp)(node.attributes, ['accessibilityRole', 'accessibilityLabel', 'accessibilityActions', 'accessible']) && !hasSpreadProps(node.attributes)) {
+ if (!(0, _jsxAstUtils.hasAnyProp)(node.attributes, ['role', 'accessibilityRole', 'accessibilityLabel', 'accessibilityActions', 'accessible']) && !hasSpreadProps(node.attributes)) {
context.report({
node,
message: errorMessage,
diff --git a/node_modules/eslint-plugin-react-native-a11y/lib/rules/has-valid-accessibility-role.js b/node_modules/eslint-plugin-react-native-a11y/lib/rules/has-valid-accessibility-role.js
index fe74702..fa6bdaa 100644
--- a/node_modules/eslint-plugin-react-native-a11y/lib/rules/has-valid-accessibility-role.js
+++ b/node_modules/eslint-plugin-react-native-a11y/lib/rules/has-valid-accessibility-role.js
@@ -13,5 +13,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
// Rule Definition
// ----------------------------------------------------------------------------
var errorMessage = 'accessibilityRole must be one of defined values';
-var validValues = ['togglebutton', 'adjustable', 'alert', 'button', 'checkbox', 'combobox', 'header', 'image', 'imagebutton', 'keyboardkey', 'link', 'menu', 'menubar', 'menuitem', 'none', 'progressbar', 'radio', 'radiogroup', 'scrollbar', 'search', 'spinbutton', 'summary', 'switch', 'tab', 'tabbar', 'tablist', 'text', 'timer', 'list', 'toolbar'];
+var validValues = ['img', 'img button', 'img link', 'togglebutton', 'adjustable', 'alert', 'button', 'checkbox', 'combobox', 'header', 'image', 'imagebutton', 'keyboardkey', 'link', 'menu', 'menubar', 'menuitem', 'none', 'progressbar', 'radio', 'radiogroup', 'scrollbar', 'search', 'spinbutton', 'summary', 'switch', 'tab', 'tabbar', 'tablist', 'text', 'timer', 'list', 'toolbar'];
module.exports = (0, _validProp.default)('accessibilityRole', validValues, errorMessage);
\ No newline at end of file
14 changes: 9 additions & 5 deletions patches/react-native-modal+13.0.1.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ index b63bcfc..bd6419e 100644
buildPanResponder: () => void;
getAccDistancePerDirection: (gestureState: PanResponderGestureState) => number;
diff --git a/node_modules/react-native-modal/dist/modal.js b/node_modules/react-native-modal/dist/modal.js
index 80f4e75..a88a2ca 100644
index 80f4e75..3ba8b8c 100644
--- a/node_modules/react-native-modal/dist/modal.js
+++ b/node_modules/react-native-modal/dist/modal.js
@@ -75,6 +75,13 @@ export class ReactNativeModal extends React.Component {
Expand All @@ -28,23 +28,27 @@ index 80f4e75..a88a2ca 100644
this.shouldPropagateSwipe = (evt, gestureState) => {
return typeof this.props.propagateSwipe === 'function'
? this.props.propagateSwipe(evt, gestureState)
@@ -454,9 +461,15 @@ export class ReactNativeModal extends React.Component {
@@ -453,10 +460,18 @@ export class ReactNativeModal extends React.Component {
if (this.state.isVisible) {
this.open();
}
BackHandler.addEventListener('hardwareBackPress', this.onBackButtonPress);
+ if (Platform.OS === 'web') {
+ document?.body?.addEventListener?.('keyup', this.handleEscape, true);
+ return;
+ }
BackHandler.addEventListener('hardwareBackPress', this.onBackButtonPress);
}
componentWillUnmount() {
BackHandler.removeEventListener('hardwareBackPress', this.onBackButtonPress);
- BackHandler.removeEventListener('hardwareBackPress', this.onBackButtonPress);
+ if (Platform.OS === 'web') {
+ document?.body?.removeEventListener?.('keyup', this.handleEscape, true);
+ } else {
+ BackHandler.removeEventListener('hardwareBackPress', this.onBackButtonPress);
+ }
if (this.didUpdateDimensionsEmitter) {
this.didUpdateDimensionsEmitter.remove();
}
@@ -525,7 +538,7 @@ export class ReactNativeModal extends React.Component {
@@ -525,7 +540,7 @@ export class ReactNativeModal extends React.Component {
}
return (React.createElement(Modal, Object.assign({ transparent: true, animationType: 'none', visible: this.state.isVisible, onRequestClose: onBackButtonPress }, otherProps),
this.makeBackdrop(),
Expand Down
Loading
Loading