react-native 0.74.0-rc.0 → 0.74.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/Libraries/AppDelegate/RCTAppDelegate.mm +1 -1
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/Libraries/Lists/FlatList.js +0 -1
  4. package/React/Base/RCTVersion.m +1 -1
  5. package/ReactAndroid/api/ReactAndroid.api +7 -56
  6. package/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp +10 -2
  7. package/ReactAndroid/gradle.properties +1 -1
  8. package/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java +1 -2
  9. package/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java +1 -2
  10. package/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java +3 -3
  11. package/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaModuleWrapper.java +1 -1
  12. package/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.java +1 -2
  13. package/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleInteropUtils.java +1 -1
  14. package/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleManager.java +1 -1
  15. package/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleManagerDelegate.java +1 -1
  16. package/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfo.java +10 -0
  17. package/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java +2 -2
  18. package/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/FrescoModule.java +1 -1
  19. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java +1 -1
  20. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  21. package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessDevSupportManager.java +1 -1
  22. package/ReactAndroid/src/main/java/com/facebook/react/runtime/CoreReactPackage.java +1 -2
  23. package/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java +1 -5
  24. package/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModule.kt +10 -11
  25. package/ReactAndroid/src/main/jni/react/fabric/CoreComponentsRegistry.cpp +0 -2
  26. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  27. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.h +1 -1
  28. package/ReactCommon/react/nativemodule/samples/platform/android/NativeSampleTurboModuleSpec.java +1 -1
  29. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h +6 -2
  30. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +16 -4
  31. package/cli.js +13 -0
  32. package/index.js +0 -5
  33. package/package.json +6 -6
  34. package/scripts/codegen/generate-artifacts-executor.js +1 -5
  35. package/sdks/hermes-engine/hermes-utils.rb +4 -3
  36. package/sdks/hermesc/osx-bin/hermes +0 -0
  37. package/sdks/hermesc/osx-bin/hermesc +0 -0
  38. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  39. package/template/package.json +3 -3
  40. package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroid.android.js +0 -69
  41. package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroid.d.ts +0 -24
  42. package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroid.js +0 -33
  43. package/Libraries/Components/PopupMenuAndroid/PopupMenuAndroidNativeComponent.js +0 -13
  44. package/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/interfaces/TurboModule.kt +0 -19
  45. package/ReactAndroid/src/main/java/com/facebook/react/views/popupmenu/PopupMenuSelectionEvent.kt +0 -38
  46. package/ReactAndroid/src/main/java/com/facebook/react/views/popupmenu/ReactPopupMenuContainer.kt +0 -49
  47. package/ReactAndroid/src/main/java/com/facebook/react/views/popupmenu/ReactPopupMenuManager.kt +0 -54
  48. package/src/private/specs/components/PopupMenuAndroidNativeComponent.js +0 -47
  49. package/template/android/gradle-wrapper.jar +0 -0
  50. package/template/android/gradle-wrapper.properties +0 -7
@@ -116,6 +116,7 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
116
116
  }
117
117
  rootView = [self createRootViewWithBridge:self.bridge moduleName:self.moduleName initProps:initProps];
118
118
  }
119
+ [self _logWarnIfCreateRootViewWithBridgeIsOverridden];
119
120
  [self customizeRootView:(RCTRootView *)rootView];
120
121
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
121
122
  UIViewController *rootViewController = [self createRootViewController];
@@ -158,7 +159,6 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
158
159
  moduleName:(NSString *)moduleName
159
160
  initProps:(NSDictionary *)initProps
160
161
  {
161
- [self _logWarnIfCreateRootViewWithBridgeIsOverridden];
162
162
  BOOL enableFabric = self.fabricEnabled;
163
163
  UIView *rootView = RCTAppSetupDefaultRootView(bridge, moduleName, initProps, enableFabric);
164
164
 
@@ -17,7 +17,7 @@ const version: $ReadOnly<{
17
17
  major: 0,
18
18
  minor: 74,
19
19
  patch: 0,
20
- prerelease: 'rc.0',
20
+ prerelease: 'rc.2',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -308,7 +308,6 @@ export type Props<ItemT> = {
308
308
  * Also inherits [ScrollView Props](docs/scrollview.html#props), unless it is nested in another FlatList of same orientation.
309
309
  */
310
310
  class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
311
- props: Props<ItemT>;
312
311
  /**
313
312
  * Scrolls to the end of the content. May be janky without `getItemLayout` prop.
314
313
  */
@@ -24,7 +24,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(74),
26
26
  RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"rc.0",
27
+ RCTVersionPrerelease: @"rc.2",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -322,7 +322,7 @@ public abstract class com/facebook/react/ReactPackageTurboModuleManagerDelegate
322
322
  protected fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;Ljava/util/List;Lcom/facebook/jni/HybridData;)V
323
323
  public fun getEagerInitModuleNames ()Ljava/util/List;
324
324
  public fun getLegacyModule (Ljava/lang/String;)Lcom/facebook/react/bridge/NativeModule;
325
- public fun getModule (Ljava/lang/String;)Lcom/facebook/react/internal/turbomodule/core/interfaces/TurboModule;
325
+ public fun getModule (Ljava/lang/String;)Lcom/facebook/react/turbomodule/core/interfaces/TurboModule;
326
326
  public fun unstable_enableSyncVoidMethods ()Z
327
327
  public fun unstable_isLegacyModuleRegistered (Ljava/lang/String;)Z
328
328
  public fun unstable_isModuleRegistered (Ljava/lang/String;)Z
@@ -2856,6 +2856,7 @@ public class com/facebook/react/module/model/ReactModuleInfo {
2856
2856
  public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZ)V
2857
2857
  public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZZ)V
2858
2858
  public fun canOverrideExistingModule ()Z
2859
+ public static fun classIsTurboModule (Ljava/lang/Class;)Z
2859
2860
  public fun className ()Ljava/lang/String;
2860
2861
  public fun hasConstants ()Z
2861
2862
  public fun isCxxModule ()Z
@@ -3199,7 +3200,7 @@ public class com/facebook/react/modules/dialog/DialogModule : com/facebook/fbrea
3199
3200
  public fun showAlert (Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Callback;Lcom/facebook/react/bridge/Callback;)V
3200
3201
  }
3201
3202
 
3202
- public class com/facebook/react/modules/fresco/FrescoModule : com/facebook/react/bridge/ReactContextBaseJavaModule, com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/internal/turbomodule/core/interfaces/TurboModule, com/facebook/react/modules/common/ModuleDataCleaner$Cleanable {
3203
+ public class com/facebook/react/modules/fresco/FrescoModule : com/facebook/react/bridge/ReactContextBaseJavaModule, com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/modules/common/ModuleDataCleaner$Cleanable, com/facebook/react/turbomodule/core/interfaces/TurboModule {
3203
3204
  public static final field NAME Ljava/lang/String;
3204
3205
  public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;)V
3205
3206
  public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;Lcom/facebook/imagepipeline/core/ImagePipeline;Z)V
@@ -3440,7 +3441,7 @@ public class com/facebook/react/modules/systeminfo/AndroidInfoHelpers {
3440
3441
  public static fun getServerHost (Ljava/lang/Integer;)Ljava/lang/String;
3441
3442
  }
3442
3443
 
3443
- public class com/facebook/react/modules/systeminfo/AndroidInfoModule : com/facebook/fbreact/specs/NativePlatformConstantsAndroidSpec, com/facebook/react/internal/turbomodule/core/interfaces/TurboModule {
3444
+ public class com/facebook/react/modules/systeminfo/AndroidInfoModule : com/facebook/fbreact/specs/NativePlatformConstantsAndroidSpec, com/facebook/react/turbomodule/core/interfaces/TurboModule {
3444
3445
  public fun <init> (Lcom/facebook/react/bridge/ReactApplicationContext;)V
3445
3446
  public fun getAndroidID ()Ljava/lang/String;
3446
3447
  public fun getTypedExportedConstants ()Ljava/util/Map;
@@ -3806,7 +3807,9 @@ public abstract interface class com/facebook/react/turbomodule/core/interfaces/C
3806
3807
  public abstract interface class com/facebook/react/turbomodule/core/interfaces/NativeMethodCallInvokerHolder {
3807
3808
  }
3808
3809
 
3809
- public abstract interface class com/facebook/react/turbomodule/core/interfaces/TurboModule : com/facebook/react/internal/turbomodule/core/interfaces/TurboModule {
3810
+ public abstract interface class com/facebook/react/turbomodule/core/interfaces/TurboModule {
3811
+ public abstract fun initialize ()V
3812
+ public abstract fun invalidate ()V
3810
3813
  }
3811
3814
 
3812
3815
  public abstract class com/facebook/react/uimanager/BaseViewManager : com/facebook/react/uimanager/ViewManager, android/view/View$OnLayoutChangeListener, com/facebook/react/uimanager/BaseViewManagerInterface {
@@ -5673,17 +5676,6 @@ public abstract interface class com/facebook/react/viewmanagers/AndroidHorizonta
5673
5676
  public abstract fun setRemoveClippedSubviews (Landroid/view/View;Z)V
5674
5677
  }
5675
5678
 
5676
- public class com/facebook/react/viewmanagers/AndroidPopupMenuManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
5677
- public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
5678
- public fun receiveCommand (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
5679
- public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
5680
- }
5681
-
5682
- public abstract interface class com/facebook/react/viewmanagers/AndroidPopupMenuManagerInterface {
5683
- public abstract fun setMenuItems (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
5684
- public abstract fun show (Landroid/view/View;)V
5685
- }
5686
-
5687
5679
  public class com/facebook/react/viewmanagers/AndroidProgressBarManagerDelegate : com/facebook/react/uimanager/BaseViewManagerDelegate {
5688
5680
  public fun <init> (Lcom/facebook/react/uimanager/BaseViewManagerInterface;)V
5689
5681
  public fun setProperty (Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
@@ -6153,47 +6145,6 @@ public abstract interface class com/facebook/react/views/modal/ReactModalHostVie
6153
6145
  public abstract fun onRequestClose (Landroid/content/DialogInterface;)V
6154
6146
  }
6155
6147
 
6156
- public final class com/facebook/react/views/popupmenu/PopupMenuSelectionEvent : com/facebook/react/uimanager/events/Event {
6157
- public static final field Companion Lcom/facebook/react/views/popupmenu/PopupMenuSelectionEvent$Companion;
6158
- public static final field EVENT_NAME Ljava/lang/String;
6159
- public fun <init> (III)V
6160
- public fun dispatch (Lcom/facebook/react/uimanager/events/RCTEventEmitter;)V
6161
- public fun getEventName ()Ljava/lang/String;
6162
- }
6163
-
6164
- public final class com/facebook/react/views/popupmenu/PopupMenuSelectionEvent$Companion {
6165
- }
6166
-
6167
- public final class com/facebook/react/views/popupmenu/ReactPopupMenuContainer : android/widget/FrameLayout {
6168
- public fun <init> (Landroid/content/Context;)V
6169
- public final fun setMenuItems (Lcom/facebook/react/bridge/ReadableArray;)V
6170
- public final fun showPopupMenu ()V
6171
- }
6172
-
6173
- public final class com/facebook/react/views/popupmenu/ReactPopupMenuManager : com/facebook/react/uimanager/ViewGroupManager, com/facebook/react/viewmanagers/AndroidPopupMenuManagerInterface {
6174
- public static final field Companion Lcom/facebook/react/views/popupmenu/ReactPopupMenuManager$Companion;
6175
- public static final field REACT_CLASS Ljava/lang/String;
6176
- public fun <init> ()V
6177
- public synthetic fun createViewInstance (Lcom/facebook/react/uimanager/ThemedReactContext;)Landroid/view/View;
6178
- public fun getName ()Ljava/lang/String;
6179
- public synthetic fun receiveCommand (Landroid/view/View;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
6180
- public fun receiveCommand (Lcom/facebook/react/views/popupmenu/ReactPopupMenuContainer;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;)V
6181
- public synthetic fun setMenuItems (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;)V
6182
- public fun setMenuItems (Lcom/facebook/react/views/popupmenu/ReactPopupMenuContainer;Lcom/facebook/react/bridge/ReadableArray;)V
6183
- public synthetic fun show (Landroid/view/View;)V
6184
- public fun show (Lcom/facebook/react/views/popupmenu/ReactPopupMenuContainer;)V
6185
- }
6186
-
6187
- public class com/facebook/react/views/popupmenu/ReactPopupMenuManager$$PropsSetter : com/facebook/react/uimanager/ViewManagerPropertyUpdater$ViewManagerSetter {
6188
- public fun <init> ()V
6189
- public fun getProperties (Ljava/util/Map;)V
6190
- public synthetic fun setProperty (Lcom/facebook/react/uimanager/ViewManager;Landroid/view/View;Ljava/lang/String;Ljava/lang/Object;)V
6191
- public fun setProperty (Lcom/facebook/react/views/popupmenu/ReactPopupMenuManager;Lcom/facebook/react/views/popupmenu/ReactPopupMenuContainer;Ljava/lang/String;Ljava/lang/Object;)V
6192
- }
6193
-
6194
- public final class com/facebook/react/views/popupmenu/ReactPopupMenuManager$Companion {
6195
- }
6196
-
6197
6148
  public class com/facebook/react/views/progressbar/ProgressBarShadowNode : com/facebook/react/uimanager/LayoutShadowNode, com/facebook/yoga/YogaMeasureFunction {
6198
6149
  public fun <init> ()V
6199
6150
  public fun getStyle ()Ljava/lang/String;
@@ -62,8 +62,16 @@ void registerComponents(
62
62
  std::shared_ptr<TurboModule> cxxModuleProvider(
63
63
  const std::string& name,
64
64
  const std::shared_ptr<CallInvoker>& jsInvoker) {
65
- // Not implemented yet: provide pure-C++ NativeModules here.
66
- return nullptr;
65
+ // Here you can provide your CXX Turbo Modules coming from
66
+ // either your application or from external libraries. The approach to follow
67
+ // is similar to the following (for a module called `NativeCxxModuleExample`):
68
+ //
69
+ // if (name == NativeCxxModuleExample::kModuleName) {
70
+ // return std::make_shared<NativeCxxModuleExample>(jsInvoker);
71
+ // }
72
+
73
+ // And we fallback to the CXX module providers autolinked by RN CLI
74
+ return rncli_cxxModuleProvider(name, jsInvoker);
67
75
  }
68
76
 
69
77
  std::shared_ptr<TurboModule> javaModuleProvider(
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.74.0-rc.0
1
+ VERSION_NAME=0.74.0-rc.2
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -17,7 +17,6 @@ import com.facebook.react.bridge.NativeModule;
17
17
  import com.facebook.react.bridge.ReactApplicationContext;
18
18
  import com.facebook.react.bridge.ReactMarker;
19
19
  import com.facebook.react.devsupport.LogBoxModule;
20
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
21
20
  import com.facebook.react.module.annotations.ReactModule;
22
21
  import com.facebook.react.module.annotations.ReactModuleList;
23
22
  import com.facebook.react.module.model.ReactModuleInfo;
@@ -115,7 +114,7 @@ class CoreModulesPackage extends TurboReactPackage implements ReactPackageLogger
115
114
  reactModule.canOverrideExistingModule(),
116
115
  reactModule.needsEagerInit(),
117
116
  reactModule.isCxxModule(),
118
- TurboModule.class.isAssignableFrom(moduleClass)));
117
+ ReactModuleInfo.classIsTurboModule(moduleClass)));
119
118
  }
120
119
 
121
120
  return () -> reactModuleInfoMap;
@@ -12,7 +12,6 @@ import com.facebook.react.bridge.ModuleSpec;
12
12
  import com.facebook.react.bridge.NativeModule;
13
13
  import com.facebook.react.bridge.ReactApplicationContext;
14
14
  import com.facebook.react.devsupport.JSCHeapCapture;
15
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
16
15
  import com.facebook.react.module.annotations.ReactModule;
17
16
  import com.facebook.react.module.annotations.ReactModuleList;
18
17
  import com.facebook.react.module.model.ReactModuleInfo;
@@ -74,7 +73,7 @@ class DebugCorePackage extends TurboReactPackage implements ViewManagerOnDemandR
74
73
  reactModule.canOverrideExistingModule(),
75
74
  reactModule.needsEagerInit(),
76
75
  reactModule.isCxxModule(),
77
- TurboModule.class.isAssignableFrom(moduleClass)));
76
+ ReactModuleInfo.classIsTurboModule(moduleClass)));
78
77
  }
79
78
 
80
79
  return () -> reactModuleInfoMap;
@@ -18,9 +18,9 @@ import com.facebook.react.bridge.ReactApplicationContext;
18
18
  import com.facebook.react.common.ReactConstants;
19
19
  import com.facebook.react.config.ReactFeatureFlags;
20
20
  import com.facebook.react.internal.turbomodule.core.TurboModuleManagerDelegate;
21
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
22
21
  import com.facebook.react.module.annotations.ReactModule;
23
22
  import com.facebook.react.module.model.ReactModuleInfo;
23
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
24
24
  import java.util.ArrayList;
25
25
  import java.util.HashMap;
26
26
  import java.util.List;
@@ -123,14 +123,14 @@ public abstract class ReactPackageTurboModuleManagerDelegate extends TurboModule
123
123
  reactModule.canOverrideExistingModule(),
124
124
  true,
125
125
  reactModule.isCxxModule(),
126
- TurboModule.class.isAssignableFrom(moduleClass))
126
+ ReactModuleInfo.classIsTurboModule(moduleClass))
127
127
  : new ReactModuleInfo(
128
128
  moduleName,
129
129
  moduleClass.getName(),
130
130
  module.canOverrideExistingModule(),
131
131
  true,
132
132
  CxxModuleWrapper.class.isAssignableFrom(moduleClass),
133
- TurboModule.class.isAssignableFrom(moduleClass));
133
+ ReactModuleInfo.classIsTurboModule(moduleClass));
134
134
 
135
135
  reactModuleInfoMap.put(moduleName, moduleInfo);
136
136
  moduleMap.put(moduleName, module);
@@ -15,7 +15,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
15
15
 
16
16
  import androidx.annotation.Nullable;
17
17
  import com.facebook.proguard.annotations.DoNotStrip;
18
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
18
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
19
19
  import com.facebook.systrace.Systrace;
20
20
  import com.facebook.systrace.SystraceMessage;
21
21
  import java.lang.reflect.Method;
@@ -20,7 +20,6 @@ import com.facebook.debug.tags.ReactDebugOverlayTags;
20
20
  import com.facebook.infer.annotation.Assertions;
21
21
  import com.facebook.proguard.annotations.DoNotStrip;
22
22
  import com.facebook.react.common.ReactConstants;
23
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
24
23
  import com.facebook.react.module.model.ReactModuleInfo;
25
24
  import com.facebook.systrace.SystraceMessage;
26
25
  import java.util.concurrent.atomic.AtomicInteger;
@@ -73,7 +72,7 @@ public class ModuleHolder {
73
72
  nativeModule.canOverrideExistingModule(),
74
73
  true,
75
74
  CxxModuleWrapper.class.isAssignableFrom(nativeModule.getClass()),
76
- TurboModule.class.isAssignableFrom(nativeModule.getClass()));
75
+ ReactModuleInfo.classIsTurboModule(nativeModule.getClass()));
77
76
 
78
77
  mModule = nativeModule;
79
78
  PrinterHolder.getPrinter()
@@ -18,7 +18,7 @@ import com.facebook.react.bridge.ReadableArray;
18
18
  import com.facebook.react.bridge.ReadableMap;
19
19
  import com.facebook.react.bridge.WritableArray;
20
20
  import com.facebook.react.bridge.WritableMap;
21
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
21
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
22
22
  import java.lang.reflect.Method;
23
23
  import java.util.ArrayList;
24
24
  import java.util.HashSet;
@@ -19,12 +19,12 @@ import com.facebook.react.bridge.NativeModule;
19
19
  import com.facebook.react.bridge.ReactNoCrashSoftException;
20
20
  import com.facebook.react.bridge.ReactSoftExceptionLogger;
21
21
  import com.facebook.react.bridge.RuntimeExecutor;
22
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
23
22
  import com.facebook.react.internal.turbomodule.core.interfaces.TurboModuleRegistry;
24
23
  import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;
25
24
  import com.facebook.react.turbomodule.core.NativeMethodCallInvokerHolderImpl;
26
25
  import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
27
26
  import com.facebook.react.turbomodule.core.interfaces.NativeMethodCallInvokerHolder;
27
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
28
28
  import java.util.ArrayList;
29
29
  import java.util.Collection;
30
30
  import java.util.HashMap;
@@ -12,7 +12,7 @@ import com.facebook.infer.annotation.Nullsafe;
12
12
  import com.facebook.jni.HybridData;
13
13
  import com.facebook.proguard.annotations.DoNotStrip;
14
14
  import com.facebook.react.bridge.NativeModule;
15
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
15
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
16
16
  import java.util.ArrayList;
17
17
  import java.util.List;
18
18
 
@@ -7,6 +7,8 @@
7
7
 
8
8
  package com.facebook.react.module.model;
9
9
 
10
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
11
+
10
12
  /**
11
13
  * Data holder class holding native module specifications. {@link ReactModuleSpecProcessor} creates
12
14
  * these so Java modules don't have to be instantiated at React Native start up.
@@ -80,4 +82,12 @@ public class ReactModuleInfo {
80
82
  public boolean isTurboModule() {
81
83
  return mIsTurboModule;
82
84
  }
85
+
86
+ /**
87
+ * Checks if the passed class is a TurboModule. Useful to populate the parameter [isTurboModule]
88
+ * in the constructor of ReactModuleInfo.
89
+ */
90
+ public static boolean classIsTurboModule(Class<?> clazz) {
91
+ return TurboModule.class.isAssignableFrom(clazz);
92
+ }
83
93
  }
@@ -161,13 +161,13 @@ public class ReactModuleSpecProcessor extends ProcessorBase {
161
161
  builder.addStatement("$T map = new $T()", MAP_TYPE, INSTANTIATED_MAP_TYPE);
162
162
 
163
163
  String turboModuleInterfaceCanonicalName =
164
- "com.facebook.react.internal.turbomodule.core.interfaces.TurboModule";
164
+ "com.facebook.react.turbomodule.core.interfaces.TurboModule";
165
165
  TypeMirror turboModuleInterface =
166
166
  mElements.getTypeElement(turboModuleInterfaceCanonicalName).asType();
167
167
 
168
168
  if (turboModuleInterface == null) {
169
169
  throw new RuntimeException(
170
- "com.facebook.react.internal.turbomodule.core.interfaces.TurboModule interface not found.");
170
+ "com.facebook.react.turbomodule.core.interfaces.TurboModule interface not found.");
171
171
  }
172
172
 
173
173
  for (String nativeModule : nativeModules) {
@@ -19,12 +19,12 @@ import com.facebook.react.bridge.ReactApplicationContext;
19
19
  import com.facebook.react.bridge.ReactContext;
20
20
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
21
21
  import com.facebook.react.common.ReactConstants;
22
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
23
22
  import com.facebook.react.module.annotations.ReactModule;
24
23
  import com.facebook.react.modules.common.ModuleDataCleaner;
25
24
  import com.facebook.react.modules.network.CookieJarContainer;
26
25
  import com.facebook.react.modules.network.ForwardingCookieHandler;
27
26
  import com.facebook.react.modules.network.OkHttpClientProvider;
27
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
28
28
  import java.util.HashSet;
29
29
  import okhttp3.JavaNetCookieJar;
30
30
  import okhttp3.OkHttpClient;
@@ -18,8 +18,8 @@ import androidx.annotation.Nullable;
18
18
  import com.facebook.fbreact.specs.NativePlatformConstantsAndroidSpec;
19
19
  import com.facebook.react.bridge.ReactApplicationContext;
20
20
  import com.facebook.react.common.build.ReactBuildConfig;
21
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
22
21
  import com.facebook.react.module.annotations.ReactModule;
22
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
23
23
  import java.util.HashMap;
24
24
  import java.util.Map;
25
25
 
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 74,
20
20
  "patch", 0,
21
- "prerelease", "rc.0");
21
+ "prerelease", "rc.2");
22
22
  }
@@ -119,7 +119,7 @@ class BridgelessDevSupportManager extends DevSupportManagerBase {
119
119
 
120
120
  @Override
121
121
  public void onJSBundleLoadedFromServer() {
122
- throw new IllegalStateException("Not implemented for bridgeless mode");
122
+ // Not implemented
123
123
  }
124
124
 
125
125
  @Override
@@ -14,7 +14,6 @@ import com.facebook.react.bridge.NativeModule;
14
14
  import com.facebook.react.bridge.ReactApplicationContext;
15
15
  import com.facebook.react.devsupport.LogBoxModule;
16
16
  import com.facebook.react.devsupport.interfaces.DevSupportManager;
17
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
18
17
  import com.facebook.react.module.annotations.ReactModule;
19
18
  import com.facebook.react.module.annotations.ReactModuleList;
20
19
  import com.facebook.react.module.model.ReactModuleInfo;
@@ -103,7 +102,7 @@ class CoreReactPackage extends TurboReactPackage {
103
102
  reactModule.canOverrideExistingModule(),
104
103
  reactModule.needsEagerInit(),
105
104
  reactModule.isCxxModule(),
106
- TurboModule.class.isAssignableFrom(moduleClass)));
105
+ ReactModuleInfo.classIsTurboModule(moduleClass)));
107
106
  }
108
107
  }
109
108
  return () -> reactModuleInfoMap;
@@ -15,7 +15,6 @@ import com.facebook.react.animated.NativeAnimatedModule;
15
15
  import com.facebook.react.bridge.ModuleSpec;
16
16
  import com.facebook.react.bridge.NativeModule;
17
17
  import com.facebook.react.bridge.ReactApplicationContext;
18
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
19
18
  import com.facebook.react.module.annotations.ReactModule;
20
19
  import com.facebook.react.module.annotations.ReactModuleList;
21
20
  import com.facebook.react.module.model.ReactModuleInfo;
@@ -47,7 +46,6 @@ import com.facebook.react.uimanager.ViewManager;
47
46
  import com.facebook.react.views.drawer.ReactDrawerLayoutManager;
48
47
  import com.facebook.react.views.image.ReactImageManager;
49
48
  import com.facebook.react.views.modal.ReactModalHostManager;
50
- import com.facebook.react.views.popupmenu.ReactPopupMenuManager;
51
49
  import com.facebook.react.views.progressbar.ReactProgressBarViewManager;
52
50
  import com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager;
53
51
  import com.facebook.react.views.scroll.ReactHorizontalScrollViewManager;
@@ -171,7 +169,6 @@ public class MainReactPackage extends TurboReactPackage implements ViewManagerOn
171
169
  viewManagers.add(new ReactScrollViewManager());
172
170
  viewManagers.add(new ReactSwitchManager());
173
171
  viewManagers.add(new SwipeRefreshLayoutManager());
174
- viewManagers.add(new ReactPopupMenuManager());
175
172
 
176
173
  // Native equivalents
177
174
  viewManagers.add(new FrescoBasedReactTextInlineImageViewManager());
@@ -213,7 +210,6 @@ public class MainReactPackage extends TurboReactPackage implements ViewManagerOn
213
210
  appendMap(viewManagers, ReactSwitchManager.REACT_CLASS, ReactSwitchManager::new);
214
211
  appendMap(
215
212
  viewManagers, SwipeRefreshLayoutManager.REACT_CLASS, SwipeRefreshLayoutManager::new);
216
- appendMap(viewManagers, ReactPopupMenuManager.REACT_CLASS, ReactPopupMenuManager::new);
217
213
  appendMap(
218
214
  viewManagers,
219
215
  FrescoBasedReactTextInlineImageViewManager.REACT_CLASS,
@@ -300,7 +296,7 @@ public class MainReactPackage extends TurboReactPackage implements ViewManagerOn
300
296
  reactModule.canOverrideExistingModule(),
301
297
  reactModule.needsEagerInit(),
302
298
  reactModule.isCxxModule(),
303
- TurboModule.class.isAssignableFrom(moduleClass)));
299
+ ReactModuleInfo.classIsTurboModule(moduleClass)));
304
300
  }
305
301
  }
306
302
  return () -> reactModuleInfoMap;
@@ -6,15 +6,14 @@
6
6
  */
7
7
 
8
8
  package com.facebook.react.turbomodule.core.interfaces
9
+ /** All turbo modules should inherit from this interface */
10
+ public interface TurboModule {
11
+ /** Initialize the TurboModule. */
12
+ public fun initialize()
9
13
 
10
- import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
11
-
12
- /**
13
- * This interface was introduced for backward compatibility purposes. This interface will be
14
- * deprecated as part of the deprecation and removal of ReactModuleInfoProvider in the near future.
15
- *
16
- * See description of https://github.com/facebook/react-native/pull/41412 for more context.
17
- */
18
- @DeprecatedInNewArchitecture
19
- public interface TurboModule :
20
- com.facebook.react.internal.turbomodule.core.interfaces.TurboModule {}
14
+ /**
15
+ * Called during the turn down process of ReactHost. This method is called before React Native is
16
+ * stopped. Override this method to clean up resources used by the TurboModule.
17
+ */
18
+ public fun invalidate()
19
+ }
@@ -67,8 +67,6 @@ CoreComponentsRegistry::sharedProviderRegistry() {
67
67
  AndroidDrawerLayoutComponentDescriptor>());
68
68
  providerRegistry->add(concreteComponentDescriptorProvider<
69
69
  DebuggingOverlayComponentDescriptor>());
70
- providerRegistry->add(concreteComponentDescriptorProvider<
71
- AndroidPopupMenuComponentDescriptor>());
72
70
 
73
71
  return providerRegistry;
74
72
  }();
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 74;
20
20
  int32_t Patch = 0;
21
- std::string_view Prerelease = "rc.0";
21
+ std::string_view Prerelease = "rc.2";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
@@ -19,7 +19,7 @@ namespace facebook::react {
19
19
 
20
20
  struct JTurboModule : jni::JavaClass<JTurboModule> {
21
21
  static auto constexpr kJavaDescriptor =
22
- "Lcom/facebook/react/internal/turbomodule/core/interfaces/TurboModule;";
22
+ "Lcom/facebook/react/turbomodule/core/interfaces/TurboModule;";
23
23
  };
24
24
 
25
25
  class JSI_EXPORT JavaTurboModule : public TurboModule {
@@ -19,7 +19,7 @@ import com.facebook.react.bridge.ReadableMap;
19
19
  import com.facebook.react.bridge.WritableArray;
20
20
  import com.facebook.react.bridge.WritableMap;
21
21
  import com.facebook.react.common.build.ReactBuildConfig;
22
- import com.facebook.react.internal.turbomodule.core.interfaces.TurboModule;
22
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
23
23
  import java.util.Arrays;
24
24
  import java.util.HashSet;
25
25
  import java.util.Map;
@@ -52,6 +52,10 @@ typedef std::shared_ptr<facebook::react::JSRuntimeFactory> (^RCTHostJSEngineProv
52
52
 
53
53
  @property (nonatomic, weak, nullable) id<RCTHostRuntimeDelegate> runtimeDelegate;
54
54
 
55
+ @property (nonatomic, readonly) RCTSurfacePresenter *surfacePresenter;
56
+
57
+ @property (nonatomic, readonly) RCTModuleRegistry *moduleRegistry;
58
+
55
59
  - (void)start;
56
60
 
57
61
  - (void)callFunctionOnJSModule:(NSString *)moduleName method:(NSString *)method args:(NSArray *)args;
@@ -64,11 +68,11 @@ typedef std::shared_ptr<facebook::react::JSRuntimeFactory> (^RCTHostJSEngineProv
64
68
 
65
69
  - (RCTFabricSurface *)createSurfaceWithModuleName:(NSString *)moduleName initialProperties:(NSDictionary *)properties;
66
70
 
67
- - (RCTSurfacePresenter *)getSurfacePresenter;
71
+ - (RCTSurfacePresenter *)getSurfacePresenter __attribute__((deprecated("Use `surfacePresenter` property instead.")));
68
72
 
69
73
  // Native module API
70
74
 
71
- - (RCTModuleRegistry *)getModuleRegistry;
75
+ - (RCTModuleRegistry *)getModuleRegistry __attribute__((deprecated("Use `moduleRegistry` property instead.")));
72
76
 
73
77
  @end
74
78
 
@@ -212,7 +212,7 @@ class RCTHostPageTargetDelegate : public facebook::react::jsinspector_modern::Pa
212
212
  mode:(DisplayMode)displayMode
213
213
  initialProperties:(NSDictionary *)properties
214
214
  {
215
- RCTFabricSurface *surface = [[RCTFabricSurface alloc] initWithSurfacePresenter:[self getSurfacePresenter]
215
+ RCTFabricSurface *surface = [[RCTFabricSurface alloc] initWithSurfacePresenter:self.surfacePresenter
216
216
  moduleName:moduleName
217
217
  initialProperties:properties];
218
218
  surface.surfaceHandler.setDisplayMode(displayMode);
@@ -235,16 +235,28 @@ class RCTHostPageTargetDelegate : public facebook::react::jsinspector_modern::Pa
235
235
  return [self createSurfaceWithModuleName:moduleName mode:DisplayMode::Visible initialProperties:properties];
236
236
  }
237
237
 
238
- - (RCTModuleRegistry *)getModuleRegistry
238
+ - (RCTModuleRegistry *)moduleRegistry
239
239
  {
240
240
  return _moduleRegistry;
241
241
  }
242
242
 
243
- - (RCTSurfacePresenter *)getSurfacePresenter
243
+ // Deprecated
244
+ - (RCTModuleRegistry *)getModuleRegistry
245
+ {
246
+ return self.moduleRegistry;
247
+ }
248
+
249
+ - (RCTSurfacePresenter *)surfacePresenter
244
250
  {
245
251
  return [_instance surfacePresenter];
246
252
  }
247
253
 
254
+ // Deprecated
255
+ - (RCTSurfacePresenter *)getSurfacePresenter
256
+ {
257
+ return self.surfacePresenter;
258
+ }
259
+
248
260
  - (void)callFunctionOnJSModule:(NSString *)moduleName method:(NSString *)method args:(NSArray *)args
249
261
  {
250
262
  [_instance callFunctionOnJSModule:moduleName method:method args:args];
@@ -276,7 +288,7 @@ class RCTHostPageTargetDelegate : public facebook::react::jsinspector_modern::Pa
276
288
  [_hostDelegate hostDidStart:self];
277
289
 
278
290
  for (RCTFabricSurface *surface in [self _getAttachedSurfaces]) {
279
- [surface resetWithSurfacePresenter:[self getSurfacePresenter]];
291
+ [surface resetWithSurfacePresenter:self.surfacePresenter];
280
292
  }
281
293
  }
282
294
 
package/cli.js CHANGED
@@ -39,6 +39,16 @@ async function getLatestVersion(registryHost = DEFAULT_REGISTRY_HOST) {
39
39
  });
40
40
  }
41
41
 
42
+ /**
43
+ * Warn when users are using `npx react-native init`, to raise awareness of the changes from RFC 0759.
44
+ * @see https://github.com/react-native-community/discussions-and-proposals/tree/main/proposals/0759-react-native-frameworks.md
45
+ */
46
+ function warnWhenRunningInit() {
47
+ if (process.argv[2] === 'init') {
48
+ console.warn('\nRunning: npx @react-native-community/cli init\n');
49
+ }
50
+ }
51
+
42
52
  /**
43
53
  * npx react-native -> @react-native-community/cli
44
54
  *
@@ -66,6 +76,9 @@ async function main() {
66
76
  // Ignore errors, since it's a nice to have warning
67
77
  }
68
78
  }
79
+
80
+ warnWhenRunningInit();
81
+
69
82
  return cli.run(name);
70
83
  }
71
84
 
package/index.js CHANGED
@@ -27,7 +27,6 @@ import typeof Clipboard from './Libraries/Components/Clipboard/Clipboard';
27
27
  import typeof DrawerLayoutAndroid from './Libraries/Components/DrawerAndroid/DrawerLayoutAndroid';
28
28
  import typeof Keyboard from './Libraries/Components/Keyboard/Keyboard';
29
29
  import typeof KeyboardAvoidingView from './Libraries/Components/Keyboard/KeyboardAvoidingView';
30
- import typeof PopupMenuAndroid from './Libraries/Components/PopupMenuAndroid/PopupMenuAndroid';
31
30
  import typeof Pressable from './Libraries/Components/Pressable/Pressable';
32
31
  import typeof ProgressBarAndroid from './Libraries/Components/ProgressBarAndroid/ProgressBarAndroid';
33
32
  import typeof RefreshControl from './Libraries/Components/RefreshControl/RefreshControl';
@@ -135,10 +134,6 @@ module.exports = {
135
134
  return require('./Libraries/Components/Keyboard/KeyboardAvoidingView')
136
135
  .default;
137
136
  },
138
- get PopupMenuAndroid(): PopupMenuAndroid {
139
- return require('./Libraries/Components/PopupMenuAndroid/PopupMenuAndroid')
140
- .default;
141
- },
142
137
  get Modal(): Modal {
143
138
  return require('./Libraries/Modal/Modal');
144
139
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.74.0-rc.0",
3
+ "version": "0.74.0-rc.2",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -98,12 +98,12 @@
98
98
  },
99
99
  "dependencies": {
100
100
  "@jest/create-cache-key-function": "^29.6.3",
101
- "@react-native-community/cli": "13.6.0",
102
- "@react-native-community/cli-platform-android": "13.6.0",
103
- "@react-native-community/cli-platform-ios": "13.6.0",
101
+ "@react-native-community/cli": "13.6.1",
102
+ "@react-native-community/cli-platform-android": "13.6.1",
103
+ "@react-native-community/cli-platform-ios": "13.6.1",
104
104
  "@react-native/assets-registry": "0.74.0",
105
- "@react-native/codegen": "0.74.1",
106
- "@react-native/community-cli-plugin": "0.74.1",
105
+ "@react-native/codegen": "0.74.2",
106
+ "@react-native/community-cli-plugin": "0.74.4",
107
107
  "@react-native/gradle-plugin": "0.74.1",
108
108
  "@react-native/js-polyfills": "0.74.0",
109
109
  "@react-native/normalize-colors": "0.74.1",
@@ -283,11 +283,7 @@ function findLibrariesFromReactNativeConfig(projectRoot) {
283
283
  return [];
284
284
  }
285
285
 
286
- return extractLibrariesFromJSON(
287
- configFile,
288
- configFile.name,
289
- codegenConfigFileDir,
290
- );
286
+ return extractLibrariesFromJSON(configFile, codegenConfigFileDir);
291
287
  });
292
288
  }
293
289
 
@@ -7,6 +7,7 @@ require 'net/http'
7
7
  require 'rexml/document'
8
8
 
9
9
  HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git"
10
+ ENV_BUILD_FROM_SOURCE = "RCT_BUILD_HERMES_FROM_SOURCE"
10
11
 
11
12
  module HermesEngineSourceType
12
13
  LOCAL_PREBUILT_TARBALL = :local_prebuilt_tarball
@@ -30,7 +31,7 @@ end
30
31
  # - To use a specific tarball, install the dependencies with:
31
32
  # `HERMES_ENGINE_TARBALL_PATH=<path_to_tarball> bundle exec pod install`
32
33
  # - To force a build from source, install the dependencies with:
33
- # `BUILD_FROM_SOURCE=true bundle exec pod install`
34
+ # `RCT_BUILD_HERMES_FROM_SOURCE=true bundle exec pod install`
34
35
  # If none of the two are provided, Cocoapods will check whether there is a tarball for the current version
35
36
  # (either release or nightly). If not, it will fall back to building from source (the latest commit on main).
36
37
  #
@@ -85,11 +86,11 @@ def hermes_commit_envvar_defined()
85
86
  end
86
87
 
87
88
  def force_build_from_tag(react_native_path)
88
- return ENV['BUILD_FROM_SOURCE'] === 'true' && File.exist?(hermestag_file(react_native_path))
89
+ return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && File.exist?(hermestag_file(react_native_path))
89
90
  end
90
91
 
91
92
  def force_build_from_main(react_native_path)
92
- return ENV['BUILD_FROM_SOURCE'] === 'true' && !File.exist?(hermestag_file(react_native_path))
93
+ return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && !File.exist?(hermestag_file(react_native_path))
93
94
  end
94
95
 
95
96
  def release_artifact_exists(version)
Binary file
Binary file
Binary file
@@ -11,15 +11,15 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "react": "18.2.0",
14
- "react-native": "0.74.0-rc.0"
14
+ "react-native": "0.74.0-rc.2"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/core": "^7.20.0",
18
18
  "@babel/preset-env": "^7.20.0",
19
19
  "@babel/runtime": "^7.20.0",
20
- "@react-native/babel-preset": "0.74.1",
20
+ "@react-native/babel-preset": "0.74.2",
21
21
  "@react-native/eslint-config": "0.74.1",
22
- "@react-native/metro-config": "0.74.1",
22
+ "@react-native/metro-config": "0.74.2",
23
23
  "@react-native/typescript-config": "0.74.1",
24
24
  "@types/react": "^18.2.6",
25
25
  "@types/react-test-renderer": "^18.0.0",
@@ -1,69 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @format
8
- * @flow strict-local
9
- */
10
-
11
- import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
12
- import type {SyntheticEvent} from '../../Types/CoreEventTypes';
13
- import type {RefObject} from 'react';
14
-
15
- import PopupMenuAndroidNativeComponent, {
16
- Commands,
17
- } from './PopupMenuAndroidNativeComponent';
18
- import nullthrows from 'nullthrows';
19
- import * as React from 'react';
20
- import {useCallback, useImperativeHandle, useRef} from 'react';
21
-
22
- type PopupMenuSelectionEvent = SyntheticEvent<
23
- $ReadOnly<{
24
- item: number,
25
- }>,
26
- >;
27
-
28
- export type PopupMenuAndroidInstance = {
29
- +show: () => void,
30
- };
31
-
32
- type Props = {
33
- menuItems: $ReadOnlyArray<string>,
34
- onSelectionChange: number => void,
35
- children: React.Node,
36
- instanceRef: RefObject<?PopupMenuAndroidInstance>,
37
- };
38
-
39
- export default function PopupMenuAndroid({
40
- menuItems,
41
- onSelectionChange,
42
- children,
43
- instanceRef,
44
- }: Props): React.Node {
45
- const nativeRef = useRef<React.ElementRef<HostComponent<mixed>> | null>(null);
46
- const _onSelectionChange = useCallback(
47
- (event: PopupMenuSelectionEvent) => {
48
- onSelectionChange(event.nativeEvent.item);
49
- },
50
- [onSelectionChange],
51
- );
52
-
53
- useImperativeHandle(instanceRef, ItemViewabilityInstance => {
54
- return {
55
- show() {
56
- Commands.show(nullthrows(nativeRef.current));
57
- },
58
- };
59
- });
60
-
61
- return (
62
- <PopupMenuAndroidNativeComponent
63
- ref={nativeRef}
64
- onSelectionChange={_onSelectionChange}
65
- menuItems={menuItems}>
66
- {children}
67
- </PopupMenuAndroidNativeComponent>
68
- );
69
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @format
8
- */
9
-
10
- import type * as React from 'react';
11
- import {HostComponent} from '../../../types/public/ReactNativeTypes';
12
-
13
- type PopupMenuAndroidInstance = {
14
- show: () => void;
15
- };
16
-
17
- type Props = {
18
- menuItems: Array<string>;
19
- onSelectionChange: (number) => void;
20
- children: React.ReactNode | undefined;
21
- instanceRef: React.ElementRef<HostComponent<PopupMenuAndroidInstance>>;
22
- };
23
-
24
- declare class PopupMenuAndroid extends React.Component<Props> {}
@@ -1,33 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @format
8
- * @flow strict-local
9
- */
10
-
11
- import type {RefObject} from 'react';
12
- import type {Node} from 'react';
13
-
14
- import * as React from 'react';
15
-
16
- const UnimplementedView = require('../UnimplementedViews/UnimplementedView');
17
-
18
- export type PopupMenuAndroidInstance = {
19
- +show: () => void,
20
- };
21
-
22
- type Props = {
23
- menuItems: $ReadOnlyArray<string>,
24
- onSelectionChange: number => void,
25
- children: Node,
26
- instanceRef: RefObject<?PopupMenuAndroidInstance>,
27
- };
28
-
29
- function PopupMenuAndroid(props: Props): Node {
30
- return <UnimplementedView />;
31
- }
32
-
33
- export default PopupMenuAndroid;
@@ -1,13 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @format
8
- * @flow strict-local
9
- */
10
-
11
- export * from '../../../src/private/specs/components/PopupMenuAndroidNativeComponent';
12
- import PopupMenuAndroidNativeComponent from '../../../src/private/specs/components/PopupMenuAndroidNativeComponent';
13
- export default PopupMenuAndroidNativeComponent;
@@ -1,19 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- package com.facebook.react.internal.turbomodule.core.interfaces
9
- /** All turbo modules should inherit from this interface */
10
- public interface TurboModule {
11
- /** Initialize the TurboModule. */
12
- public fun initialize()
13
-
14
- /**
15
- * Called during the turn down process of ReactHost. This method is called before React Native is
16
- * stopped. Override this method to clean up resources used by the TurboModule.
17
- */
18
- public fun invalidate()
19
- }
@@ -1,38 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- @file:Suppress("DEPRECATION") // We want to use RCTEventEmitter for interop purposes
9
-
10
- package com.facebook.react.views.popupmenu
11
-
12
- import com.facebook.react.bridge.Arguments
13
- import com.facebook.react.bridge.WritableMap
14
- import com.facebook.react.uimanager.events.Event
15
- import com.facebook.react.uimanager.events.RCTEventEmitter
16
-
17
- public class PopupMenuSelectionEvent(surfaceId: Int, viewId: Int, private val item: Int) :
18
- Event<PopupMenuSelectionEvent>(surfaceId, viewId) {
19
-
20
- override fun getEventName(): String {
21
- return EVENT_NAME
22
- }
23
-
24
- override fun getEventData(): WritableMap {
25
- val eventData: WritableMap = Arguments.createMap()
26
- eventData.putInt("target", viewTag)
27
- eventData.putDouble("item", item.toDouble())
28
- return eventData
29
- }
30
-
31
- override fun dispatch(rctEventEmitter: RCTEventEmitter) {
32
- rctEventEmitter.receiveEvent(viewTag, eventName, eventData)
33
- }
34
-
35
- public companion object {
36
- public const val EVENT_NAME: String = "topSelectionChange"
37
- }
38
- }
@@ -1,49 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- package com.facebook.react.views.popupmenu
9
-
10
- import android.content.Context
11
- import android.os.Build
12
- import android.view.Menu
13
- import android.widget.FrameLayout
14
- import android.widget.PopupMenu
15
- import com.facebook.react.bridge.ReactContext
16
- import com.facebook.react.bridge.ReadableArray
17
- import com.facebook.react.uimanager.UIManagerHelper
18
-
19
- public class ReactPopupMenuContainer(context: Context) : FrameLayout(context) {
20
- private var menuItems: ReadableArray? = null
21
-
22
- public fun setMenuItems(items: ReadableArray?) {
23
- menuItems = items
24
- }
25
-
26
- public fun showPopupMenu() {
27
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
28
- val view = getChildAt(0)
29
- val popupMenu = PopupMenu(context, view)
30
- var menu = popupMenu.menu
31
- val items = menuItems
32
- if (items != null) {
33
- for (i in 0 until items.size()) {
34
- menu.add(Menu.NONE, Menu.NONE, i, items.getString(i))
35
- }
36
- }
37
- popupMenu.setOnMenuItemClickListener { menuItem ->
38
- val reactContext = context as ReactContext
39
- val eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
40
- if (eventDispatcher != null) {
41
- val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
42
- eventDispatcher.dispatchEvent(PopupMenuSelectionEvent(surfaceId, id, menuItem.order))
43
- }
44
- true
45
- }
46
- popupMenu.show()
47
- }
48
- }
49
- }
@@ -1,54 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- package com.facebook.react.views.popupmenu
9
-
10
- import com.facebook.react.bridge.ReadableArray
11
- import com.facebook.react.module.annotations.ReactModule
12
- import com.facebook.react.uimanager.ThemedReactContext
13
- import com.facebook.react.uimanager.ViewGroupManager
14
- import com.facebook.react.uimanager.annotations.ReactProp
15
- import com.facebook.react.viewmanagers.AndroidPopupMenuManagerInterface
16
-
17
- @ReactModule(name = ReactPopupMenuManager.REACT_CLASS)
18
- public class ReactPopupMenuManager :
19
- ViewGroupManager<ReactPopupMenuContainer>(),
20
- AndroidPopupMenuManagerInterface<ReactPopupMenuContainer> {
21
- override fun createViewInstance(reactContext: ThemedReactContext): ReactPopupMenuContainer {
22
- return ReactPopupMenuContainer(reactContext)
23
- }
24
-
25
- @ReactProp(name = "menuItems")
26
- override fun setMenuItems(view: ReactPopupMenuContainer, menuItems: ReadableArray?) {
27
- view.setMenuItems(menuItems)
28
- }
29
-
30
- override fun getName(): String {
31
- return REACT_CLASS
32
- }
33
-
34
- override fun receiveCommand(
35
- view: ReactPopupMenuContainer,
36
- commandId: String,
37
- items: ReadableArray?
38
- ) {
39
- when (commandId) {
40
- "show" -> show(view)
41
- else -> {
42
- // no-op
43
- }
44
- }
45
- }
46
-
47
- override fun show(popupMenu: ReactPopupMenuContainer) {
48
- popupMenu.showPopupMenu()
49
- }
50
-
51
- public companion object {
52
- public const val REACT_CLASS: String = "AndroidPopupMenu"
53
- }
54
- }
@@ -1,47 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow strict-local
8
- * @format
9
- */
10
-
11
- import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
12
- import type {HostComponent} from '../../../../Libraries/Renderer/shims/ReactNativeTypes';
13
- import type {
14
- DirectEventHandler,
15
- Int32,
16
- } from '../../../../Libraries/Types/CodegenTypes';
17
-
18
- import codegenNativeCommands from '../../../../Libraries/Utilities/codegenNativeCommands';
19
- import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
20
- import * as React from 'react';
21
-
22
- type PopupMenuSelectionEvent = $ReadOnly<{
23
- item: Int32,
24
- }>;
25
-
26
- type NativeProps = $ReadOnly<{
27
- ...ViewProps,
28
-
29
- //Props
30
- menuItems?: ?$ReadOnlyArray<string>,
31
-
32
- onSelectionChange?: DirectEventHandler<PopupMenuSelectionEvent>,
33
- }>;
34
-
35
- type ComponentType = HostComponent<NativeProps>;
36
-
37
- interface NativeCommands {
38
- +show: (viewRef: React.ElementRef<ComponentType>) => void;
39
- }
40
-
41
- export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
42
- supportedCommands: ['show'],
43
- });
44
-
45
- export default (codegenNativeComponent<NativeProps>(
46
- 'AndroidPopupMenu',
47
- ): HostComponent<NativeProps>);
Binary file
@@ -1,7 +0,0 @@
1
- distributionBase=GRADLE_USER_HOME
2
- distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
4
- networkTimeout=10000
5
- validateDistributionUrl=true
6
- zipStoreBase=GRADLE_USER_HOME
7
- zipStorePath=wrapper/dists