Repository navigation
Commit a95f00f
authored
Resolve
## Description
Since React Native 0.87 the `DrawerLayoutAndroid` export is a getter
that logs `DrawerLayoutAndroid is deprecated and will be removed in a
future release` through `warnOnce` on first access.
`GestureComponents.tsx` imported it at module level to build
`LegacyDrawerLayoutAndroid`, so every app that imports gesture-handler
saw the warning at startup, even if it never rendered a drawer.
`LegacyDrawerLayoutAndroid` now wraps a small component that reads
`DrawerLayoutAndroid` from `react-native` on first render and caches it
in a module-level variable, so the warning appears only for apps that
actually render the deprecated wrapper. The read uses `require` rather
than `import * as RN`, because Metro's `experimentalImportSupport`
(enabled by default in Expo) copies every export eagerly and would
trigger all of RN's deprecation getters at once.
Fixes #4491
## Test plan
- `yarn ts-check`, `yarn test` and `yarn lint:js` in the package
- `yarn ts-check` in `apps/basic-example`
- `basic-example` on Android: no deprecation warning at startup, one
warning when opening the `Drawer Layout` screen; open/close via edge
swipe and via ref buttons, drawer callbacks and `RectButton` presses
workDrawerLayoutAndroid lazily to avoid RN deprecation warning on import (#4493)1 parent e9ff66f commit a95f00f
1 file changed
Lines changed: 30 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
99 | 121 | | |
100 | 122 | | |
101 | 123 | | |
102 | 124 | | |
103 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
104 | 130 | | |
105 | | - | |
| 131 | + | |
106 | 132 | | |
107 | 133 | | |
108 | 134 | | |
109 | 135 | | |
110 | | - | |
| 136 | + | |
111 | 137 | | |
112 | 138 | | |
113 | 139 | | |
| |||
0 commit comments