Skip to content

Commit 33addd3

Browse files
committed
Add enableIOSExperimentalAutoFocusImplementation feature falg
1 parent ccff70b commit 33addd3

22 files changed

Lines changed: 209 additions & 87 deletions

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<eb70fd41bc36f1a49849e29bea081007>>
7+
* @generated SignedSource<<1e2cf81bf4354a7e3d9d09384d813cfc>>
88
*/
99

1010
/**
@@ -186,6 +186,12 @@ public object ReactNativeFeatureFlags {
186186
@JvmStatic
187187
public fun enableFontScaleChangesUpdatingLayout(): Boolean = accessor.enableFontScaleChangesUpdatingLayout()
188188

189+
/**
190+
* Fixes #56595 by moving the autoFocus from didMoveToWindow to viewDidAppear
191+
*/
192+
@JvmStatic
193+
public fun enableIOSExperimentalAutoFocusImplementation(): Boolean = accessor.enableIOSExperimentalAutoFocusImplementation()
194+
189195
/**
190196
* Applies base offset for each line of text separately on iOS.
191197
*/

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<f79ca61a0da053a1661eca4d3a35b081>>
7+
* @generated SignedSource<<8dd2a1c47c059810961eb66b13b18dc1>>
88
*/
99

1010
/**
@@ -46,6 +46,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
4646
private var enableFabricLogsCache: Boolean? = null
4747
private var enableFabricRendererCache: Boolean? = null
4848
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
49+
private var enableIOSExperimentalAutoFocusImplementationCache: Boolean? = null
4950
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
5051
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
5152
private var enableImagePrefetchingAndroidCache: Boolean? = null
@@ -346,6 +347,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
346347
return cached
347348
}
348349

350+
override fun enableIOSExperimentalAutoFocusImplementation(): Boolean {
351+
var cached = enableIOSExperimentalAutoFocusImplementationCache
352+
if (cached == null) {
353+
cached = ReactNativeFeatureFlagsCxxInterop.enableIOSExperimentalAutoFocusImplementation()
354+
enableIOSExperimentalAutoFocusImplementationCache = cached
355+
}
356+
return cached
357+
}
358+
349359
override fun enableIOSTextBaselineOffsetPerLine(): Boolean {
350360
var cached = enableIOSTextBaselineOffsetPerLineCache
351361
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<62d1f0fcdf8e3165480da12575d62826>>
7+
* @generated SignedSource<<a6ccb3bb68e8b300fdabf085e7ea6979>>
88
*/
99

1010
/**
@@ -80,6 +80,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
8080

8181
@DoNotStrip @JvmStatic public external fun enableFontScaleChangesUpdatingLayout(): Boolean
8282

83+
@DoNotStrip @JvmStatic public external fun enableIOSExperimentalAutoFocusImplementation(): Boolean
84+
8385
@DoNotStrip @JvmStatic public external fun enableIOSTextBaselineOffsetPerLine(): Boolean
8486

8587
@DoNotStrip @JvmStatic public external fun enableIOSViewClipToPaddingBox(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<84ac5b80585f9185c879c81822718d86>>
7+
* @generated SignedSource<<27361d399f26a6f7462a82f9fbfd5d48>>
88
*/
99

1010
/**
@@ -75,6 +75,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
7575

7676
override fun enableFontScaleChangesUpdatingLayout(): Boolean = true
7777

78+
override fun enableIOSExperimentalAutoFocusImplementation(): Boolean = false
79+
7880
override fun enableIOSTextBaselineOffsetPerLine(): Boolean = false
7981

8082
override fun enableIOSViewClipToPaddingBox(): Boolean = false

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<3574e23fe8f846e408964af26cf0dd4c>>
7+
* @generated SignedSource<<eccc96e3e69fa903211ef5dafb4027ea>>
88
*/
99

1010
/**
@@ -50,6 +50,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
5050
private var enableFabricLogsCache: Boolean? = null
5151
private var enableFabricRendererCache: Boolean? = null
5252
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
53+
private var enableIOSExperimentalAutoFocusImplementationCache: Boolean? = null
5354
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
5455
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
5556
private var enableImagePrefetchingAndroidCache: Boolean? = null
@@ -376,6 +377,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
376377
return cached
377378
}
378379

380+
override fun enableIOSExperimentalAutoFocusImplementation(): Boolean {
381+
var cached = enableIOSExperimentalAutoFocusImplementationCache
382+
if (cached == null) {
383+
cached = currentProvider.enableIOSExperimentalAutoFocusImplementation()
384+
accessedFeatureFlags.add("enableIOSExperimentalAutoFocusImplementation")
385+
enableIOSExperimentalAutoFocusImplementationCache = cached
386+
}
387+
return cached
388+
}
389+
379390
override fun enableIOSTextBaselineOffsetPerLine(): Boolean {
380391
var cached = enableIOSTextBaselineOffsetPerLineCache
381392
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<187ac62197545fbce9d537527b4aed3b>>
7+
* @generated SignedSource<<d6ba6e0ef20d07717948f7bfdacb9c17>>
88
*/
99

1010
/**
@@ -27,6 +27,8 @@ public open class ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android :
2727

2828
override fun enableAccessibilityOrder(): Boolean = true
2929

30+
override fun enableIOSExperimentalAutoFocusImplementation(): Boolean = true
31+
3032
override fun enableSwiftUIBasedFilters(): Boolean = true
3133

3234
override fun preventShadowTreeCommitExhaustion(): Boolean = true

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<9222fd90d191a91893e2c58770d83259>>
7+
* @generated SignedSource<<b223e1cfe403041057d018e267e3bf7f>>
88
*/
99

1010
/**
@@ -75,6 +75,8 @@ public interface ReactNativeFeatureFlagsProvider {
7575

7676
@DoNotStrip public fun enableFontScaleChangesUpdatingLayout(): Boolean
7777

78+
@DoNotStrip public fun enableIOSExperimentalAutoFocusImplementation(): Boolean
79+
7880
@DoNotStrip public fun enableIOSTextBaselineOffsetPerLine(): Boolean
7981

8082
@DoNotStrip public fun enableIOSViewClipToPaddingBox(): Boolean

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<e8cf371a99a72250ea1b0104dc7f8254>>
7+
* @generated SignedSource<<b8b2b6bd1dbc251e292e85d54deec9d7>>
88
*/
99

1010
/**
@@ -195,6 +195,12 @@ class ReactNativeFeatureFlagsJavaProvider
195195
return method(javaProvider_);
196196
}
197197

198+
bool enableIOSExperimentalAutoFocusImplementation() override {
199+
static const auto method =
200+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableIOSExperimentalAutoFocusImplementation");
201+
return method(javaProvider_);
202+
}
203+
198204
bool enableIOSTextBaselineOffsetPerLine() override {
199205
static const auto method =
200206
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableIOSTextBaselineOffsetPerLine");
@@ -719,6 +725,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableFontScaleChangesUpdatingLayout(
719725
return ReactNativeFeatureFlags::enableFontScaleChangesUpdatingLayout();
720726
}
721727

728+
bool JReactNativeFeatureFlagsCxxInterop::enableIOSExperimentalAutoFocusImplementation(
729+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
730+
return ReactNativeFeatureFlags::enableIOSExperimentalAutoFocusImplementation();
731+
}
732+
722733
bool JReactNativeFeatureFlagsCxxInterop::enableIOSTextBaselineOffsetPerLine(
723734
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
724735
return ReactNativeFeatureFlags::enableIOSTextBaselineOffsetPerLine();
@@ -1153,6 +1164,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
11531164
makeNativeMethod(
11541165
"enableFontScaleChangesUpdatingLayout",
11551166
JReactNativeFeatureFlagsCxxInterop::enableFontScaleChangesUpdatingLayout),
1167+
makeNativeMethod(
1168+
"enableIOSExperimentalAutoFocusImplementation",
1169+
JReactNativeFeatureFlagsCxxInterop::enableIOSExperimentalAutoFocusImplementation),
11561170
makeNativeMethod(
11571171
"enableIOSTextBaselineOffsetPerLine",
11581172
JReactNativeFeatureFlagsCxxInterop::enableIOSTextBaselineOffsetPerLine),

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<773741594e911047dac28904e9fc9544>>
7+
* @generated SignedSource<<0d42119f721e3240e5d140b865547e18>>
88
*/
99

1010
/**
@@ -108,6 +108,9 @@ class JReactNativeFeatureFlagsCxxInterop
108108
static bool enableFontScaleChangesUpdatingLayout(
109109
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
110110

111+
static bool enableIOSExperimentalAutoFocusImplementation(
112+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
113+
111114
static bool enableIOSTextBaselineOffsetPerLine(
112115
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
113116

packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<6a15a6444767342acf4da0c0c8aa6208>>
7+
* @generated SignedSource<<11c0b22fb3739bdbb269084214263fe3>>
88
*/
99

1010
/**
@@ -130,6 +130,10 @@ bool ReactNativeFeatureFlags::enableFontScaleChangesUpdatingLayout() {
130130
return getAccessor().enableFontScaleChangesUpdatingLayout();
131131
}
132132

133+
bool ReactNativeFeatureFlags::enableIOSExperimentalAutoFocusImplementation() {
134+
return getAccessor().enableIOSExperimentalAutoFocusImplementation();
135+
}
136+
133137
bool ReactNativeFeatureFlags::enableIOSTextBaselineOffsetPerLine() {
134138
return getAccessor().enableIOSTextBaselineOffsetPerLine();
135139
}

0 commit comments

Comments
 (0)