Commit 417830c
Android: Add new configuration for
Summary:
Following the [RFC](react-native-community/discussions-and-proposals#925), this PR adds new `DevMenuConfiguration` object and extends `ReactHost` API for passing settings to the particular `DevSupportManager`. The `DevMenuConfiguration` includes:
- isDevMenuEnabled,
- isShakeGestureEnabled,
- areKeyboardShortcutsEnabled,
## Changelog:
[ANDROID][ADDED] - Add new configuration for `RCTDevMenu`
Test Plan:
Tested with different configuration on `DevMenuConfiguration`:
<details>
<summary>Click to view code</summary>
```kt
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
fullyDrawnReporter.addReporter()
maybeUpdateBackgroundColor()
reactDelegate?.reactHost?.let { reactHost ->
val devMenuConfiguration = DevMenuConfiguration(
isDevMenuEnabled = true,
isShakeGestureEnabled = false,
areKeyboardShortcutsEnabled = false,
)
reactHost.setDevMenuConfiguration(devMenuConfiguration)
}
// register insets listener to update margins on the ReactRootView to avoid overlap w/ system
// bars
reactDelegate?.reactRootView?.let { rootView ->
val insetsType: Int =
WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()
val windowInsetsListener = { view: View, windowInsets: WindowInsetsCompat ->
val insets = windowInsets.getInsets(insetsType)
(view.layoutParams as FrameLayout.LayoutParams).apply {
setMargins(insets.left, insets.top, insets.right, insets.bottom)
}
WindowInsetsCompat.CONSUMED
}
ViewCompat.setOnApplyWindowInsetsListener(rootView, windowInsetsListener)
}
}
```
</details>
Differential Revision: D81684310
Pulled By: coadoDevSupportManager (#53557)1 parent c472059 commit 417830c
File tree
9 files changed
+141
-10
lines changed- packages
- react-native/ReactAndroid
- api
- src/main/java/com/facebook/react
- devsupport
- interfaces
- runtime
- rn-tester/android/app/src/main/java/com/facebook/react/uiapp
9 files changed
+141
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
| |||
1900 | 1901 | | |
1901 | 1902 | | |
1902 | 1903 | | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
1903 | 1913 | | |
1904 | 1914 | | |
1905 | 1915 | | |
| |||
1941 | 1951 | | |
1942 | 1952 | | |
1943 | 1953 | | |
| 1954 | + | |
1944 | 1955 | | |
1945 | 1956 | | |
1946 | 1957 | | |
1947 | 1958 | | |
1948 | 1959 | | |
| 1960 | + | |
1949 | 1961 | | |
1950 | 1962 | | |
1951 | 1963 | | |
1952 | 1964 | | |
1953 | 1965 | | |
1954 | 1966 | | |
| 1967 | + | |
1955 | 1968 | | |
1956 | 1969 | | |
1957 | 1970 | | |
| |||
1970 | 1983 | | |
1971 | 1984 | | |
1972 | 1985 | | |
| 1986 | + | |
1973 | 1987 | | |
1974 | 1988 | | |
1975 | 1989 | | |
| 1990 | + | |
1976 | 1991 | | |
1977 | 1992 | | |
1978 | 1993 | | |
1979 | 1994 | | |
1980 | 1995 | | |
| 1996 | + | |
1981 | 1997 | | |
1982 | 1998 | | |
1983 | 1999 | | |
| |||
2034 | 2050 | | |
2035 | 2051 | | |
2036 | 2052 | | |
| 2053 | + | |
2037 | 2054 | | |
2038 | 2055 | | |
2039 | 2056 | | |
| 2057 | + | |
2040 | 2058 | | |
2041 | 2059 | | |
2042 | 2060 | | |
2043 | 2061 | | |
2044 | 2062 | | |
| 2063 | + | |
2045 | 2064 | | |
2046 | 2065 | | |
2047 | 2066 | | |
| |||
2058 | 2077 | | |
2059 | 2078 | | |
2060 | 2079 | | |
| 2080 | + | |
2061 | 2081 | | |
2062 | 2082 | | |
2063 | 2083 | | |
| 2084 | + | |
2064 | 2085 | | |
| 2086 | + | |
2065 | 2087 | | |
2066 | 2088 | | |
2067 | 2089 | | |
| |||
2136 | 2158 | | |
2137 | 2159 | | |
2138 | 2160 | | |
| 2161 | + | |
2139 | 2162 | | |
2140 | 2163 | | |
2141 | 2164 | | |
| 2165 | + | |
2142 | 2166 | | |
2143 | 2167 | | |
2144 | 2168 | | |
2145 | 2169 | | |
2146 | 2170 | | |
| 2171 | + | |
2147 | 2172 | | |
2148 | 2173 | | |
2149 | 2174 | | |
| |||
2160 | 2185 | | |
2161 | 2186 | | |
2162 | 2187 | | |
| 2188 | + | |
2163 | 2189 | | |
2164 | 2190 | | |
2165 | 2191 | | |
| 2192 | + | |
2166 | 2193 | | |
| 2194 | + | |
2167 | 2195 | | |
2168 | 2196 | | |
2169 | 2197 | | |
| |||
3075 | 3103 | | |
3076 | 3104 | | |
3077 | 3105 | | |
| 3106 | + | |
3078 | 3107 | | |
3079 | 3108 | | |
3080 | 3109 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
397 | 401 | | |
398 | 402 | | |
399 | 403 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
192 | 196 | | |
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
Lines changed: 40 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
132 | 148 | | |
133 | 149 | | |
134 | 150 | | |
| |||
172 | 188 | | |
173 | 189 | | |
174 | 190 | | |
| 191 | + | |
175 | 192 | | |
176 | 193 | | |
177 | 194 | | |
| |||
187 | 204 | | |
188 | 205 | | |
189 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
190 | 210 | | |
191 | 211 | | |
192 | 212 | | |
| |||
325 | 345 | | |
326 | 346 | | |
327 | 347 | | |
328 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
329 | 354 | | |
330 | 355 | | |
331 | 356 | | |
| |||
861 | 886 | | |
862 | 887 | | |
863 | 888 | | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
864 | 900 | | |
865 | 901 | | |
866 | 902 | | |
| |||
870 | 906 | | |
871 | 907 | | |
872 | 908 | | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
| 909 | + | |
| 910 | + | |
878 | 911 | | |
879 | 912 | | |
880 | 913 | | |
| |||
926 | 959 | | |
927 | 960 | | |
928 | 961 | | |
929 | | - | |
930 | | - | |
| 962 | + | |
931 | 963 | | |
932 | 964 | | |
933 | 965 | | |
| |||
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
74 | 86 | | |
75 | 87 | | |
76 | 88 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
39 | 51 | | |
40 | 52 | | |
41 | 53 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
365 | 366 | | |
366 | 367 | | |
367 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
368 | 375 | | |
369 | 376 | | |
370 | 377 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
69 | 80 | | |
70 | 81 | | |
71 | 82 | | |
| |||
0 commit comments