react-native 0.85.1 → 0.85.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.
@@ -28,7 +28,7 @@
28
28
  export default class ReactNativeVersion {
29
29
  static major: number = 0;
30
30
  static minor: number = 85;
31
- static patch: number = 1;
31
+ static patch: number = 2;
32
32
  static prerelease: string | null = null;
33
33
 
34
34
  static getVersionString(): string {
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(85),
26
- RCTVersionPatch: @(1),
26
+ RCTVersionPatch: @(2),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -51,10 +51,27 @@ RCT_EXPORT_MODULE()
51
51
  selector:@selector(hide)
52
52
  name:RCTJavaScriptDidFailToLoadNotification
53
53
  object:nil];
54
+ [[NSNotificationCenter defaultCenter] addObserver:self
55
+ selector:@selector(hide)
56
+ name:@"RCTInstanceDidLoadBundle"
57
+ object:nil];
54
58
  }
55
59
  return self;
56
60
  }
57
61
 
62
+ - (void)dealloc
63
+ {
64
+ [self clearInitialMessageDelay];
65
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
66
+ UIWindow *window = _window;
67
+ _window = nil;
68
+ if (window) {
69
+ RCTExecuteOnMainQueue(^{
70
+ window.hidden = YES;
71
+ });
72
+ }
73
+ }
74
+
58
75
  + (void)setEnabled:(BOOL)enabled
59
76
  {
60
77
  RCTDevLoadingViewSetEnabled(enabled);
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.85.1
1
+ VERSION_NAME=0.85.2
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
  react.internal.hermesPublishingGroup=com.facebook.hermes
4
4
 
@@ -14,7 +14,7 @@ public object ReactNativeVersion {
14
14
  public val VERSION: Map<String, Any?> = mapOf(
15
15
  "major" to 0,
16
16
  "minor" to 85,
17
- "patch" to 1,
17
+ "patch" to 2,
18
18
  "prerelease" to null
19
19
  )
20
20
  }
@@ -14,14 +14,14 @@
14
14
 
15
15
  #define REACT_NATIVE_VERSION_MAJOR 0
16
16
  #define REACT_NATIVE_VERSION_MINOR 85
17
- #define REACT_NATIVE_VERSION_PATCH 1
17
+ #define REACT_NATIVE_VERSION_PATCH 2
18
18
 
19
19
  namespace facebook::react {
20
20
 
21
21
  struct ReactNativeVersionType {
22
22
  int32_t Major = 0;
23
23
  int32_t Minor = 85;
24
- int32_t Patch = 1;
24
+ int32_t Patch = 2;
25
25
  std::string_view Prerelease = "";
26
26
  };
27
27
 
@@ -515,7 +515,10 @@ void NativeAnimatedNodesManager::handleAnimatedEvent(
515
515
  // frames.
516
516
  if (ReactNativeFeatureFlags::useSharedAnimatedBackend()) {
517
517
  if (auto animationBackend = animationBackend_.lock()) {
518
- animationBackend->trigger();
518
+ animationBackend->pushAnimationMutations(
519
+ [this](AnimationTimestamp timestamp) -> AnimationMutations {
520
+ return pullAnimationMutations(timestamp);
521
+ });
519
522
  }
520
523
  } else {
521
524
  onRender();
@@ -24,10 +24,17 @@ static inline Props::Shared cloneProps(
24
24
  shadowNode.getSurfaceId(), *shadowNode.getContextContainer()};
25
25
  Props::Shared newProps;
26
26
  if (animatedProps.rawProps) {
27
- newProps = shadowNode.getComponentDescriptor().cloneProps(
28
- propsParserContext,
29
- shadowNode.getProps(),
30
- std::move(*animatedProps.rawProps));
27
+ if (ReactNativeFeatureFlags::enableFabricCommitBranching()) {
28
+ newProps = shadowNode.getComponentDescriptor().cloneProps(
29
+ propsParserContext,
30
+ shadowNode.getProps(),
31
+ std::move(*animatedProps.rawProps));
32
+ } else {
33
+ newProps = shadowNode.getComponentDescriptor().cloneProps(
34
+ propsParserContext,
35
+ shadowNode.getProps(),
36
+ RawProps(*animatedProps.rawProps));
37
+ }
31
38
  } else {
32
39
  newProps = shadowNode.getComponentDescriptor().cloneProps(
33
40
  propsParserContext, shadowNode.getProps(), {});
@@ -51,31 +58,27 @@ AnimationBackend::AnimationBackend(
51
58
  react_native_assert(uiManager_.expired() == false);
52
59
  }
53
60
 
54
- void AnimationBackend::onAnimationFrame(AnimationTimestamp timestamp) {
55
- std::vector<CallbackWithId> callbacksCopy;
56
- std::unordered_map<SurfaceId, SurfaceUpdates> surfaceUpdates;
57
- std::set<SurfaceId> asyncFlushSurfaces;
61
+ void AnimationBackend::unpackMutations(
62
+ AnimationMutations& mutations,
63
+ std::unordered_map<SurfaceId, SurfaceUpdates>& surfaceUpdates,
64
+ std::set<SurfaceId>& asyncFlushSurfaces) {
65
+ for (auto& mutation : mutations.batch) {
66
+ const auto family = mutation.family;
67
+ react_native_assert(family != nullptr);
58
68
 
59
- {
60
- std::lock_guard lock(mutex_);
61
- callbacksCopy = callbacks;
69
+ auto& [families, updates, hasLayoutUpdates] =
70
+ surfaceUpdates[family->getSurfaceId()];
71
+ hasLayoutUpdates |= mutation.hasLayoutUpdates;
72
+ families.insert(family);
73
+ updates[mutation.tag] = std::move(mutation.props);
62
74
  }
63
75
 
64
- for (auto& callbackWithId : callbacksCopy) {
65
- auto mutations = callbackWithId.callback(timestamp);
66
- asyncFlushSurfaces.merge(mutations.asyncFlushSurfaces);
67
- for (auto& mutation : mutations.batch) {
68
- const auto family = mutation.family;
69
- react_native_assert(family != nullptr);
70
-
71
- auto& [families, updates, hasLayoutUpdates] =
72
- surfaceUpdates[family->getSurfaceId()];
73
- hasLayoutUpdates |= mutation.hasLayoutUpdates;
74
- families.insert(family);
75
- updates[mutation.tag] = std::move(mutation.props);
76
- }
77
- }
76
+ asyncFlushSurfaces.merge(mutations.asyncFlushSurfaces);
77
+ }
78
78
 
79
+ void AnimationBackend::applySurfaceUpdates(
80
+ std::unordered_map<SurfaceId, SurfaceUpdates>& surfaceUpdates,
81
+ const std::set<SurfaceId>& asyncFlushSurfaces) {
79
82
  animatedPropsRegistry_->update(surfaceUpdates);
80
83
 
81
84
  for (auto& [surfaceId, updates] : surfaceUpdates) {
@@ -89,6 +92,30 @@ void AnimationBackend::onAnimationFrame(AnimationTimestamp timestamp) {
89
92
  requestAsyncFlushForSurfaces(asyncFlushSurfaces);
90
93
  }
91
94
 
95
+ void AnimationBackend::applyMutations(AnimationMutations mutations) {
96
+ std::unordered_map<SurfaceId, SurfaceUpdates> surfaceUpdates;
97
+ std::set<SurfaceId> asyncFlushSurfaces;
98
+ unpackMutations(mutations, surfaceUpdates, asyncFlushSurfaces);
99
+ applySurfaceUpdates(surfaceUpdates, asyncFlushSurfaces);
100
+ }
101
+
102
+ void AnimationBackend::onAnimationFrame(AnimationTimestamp timestamp) {
103
+ std::vector<CallbackWithId> callbacksCopy;
104
+
105
+ {
106
+ std::lock_guard lock(mutex_);
107
+ callbacksCopy = callbacks;
108
+ }
109
+
110
+ std::unordered_map<SurfaceId, SurfaceUpdates> surfaceUpdates;
111
+ std::set<SurfaceId> asyncFlushSurfaces;
112
+ for (auto& callbackWithId : callbacksCopy) {
113
+ auto mutations = callbackWithId.callback(timestamp);
114
+ unpackMutations(mutations, surfaceUpdates, asyncFlushSurfaces);
115
+ }
116
+ applySurfaceUpdates(surfaceUpdates, asyncFlushSurfaces);
117
+ }
118
+
92
119
  CallbackId AnimationBackend::start(const Callback& callback) {
93
120
  std::lock_guard lock(mutex_);
94
121
 
@@ -123,6 +150,12 @@ void AnimationBackend::trigger() {
123
150
  onAnimationFrame(std::chrono::steady_clock::now().time_since_epoch());
124
151
  }
125
152
 
153
+ void AnimationBackend::pushAnimationMutations(const Callback& callback) {
154
+ auto timestamp = animationChoreographer_->now();
155
+ auto mutations = callback(timestamp);
156
+ applyMutations(std::move(mutations));
157
+ }
158
+
126
159
  void AnimationBackend::commitUpdates(
127
160
  SurfaceId surfaceId,
128
161
  SurfaceUpdates& surfaceUpdates) {
@@ -60,10 +60,19 @@ class AnimationBackend : public UIManagerAnimationBackend {
60
60
 
61
61
  void onAnimationFrame(AnimationTimestamp timestamp) override;
62
62
  void trigger() override;
63
+ void pushAnimationMutations(const Callback &callback) override;
63
64
  CallbackId start(const Callback &callback) override;
64
65
  void stop(CallbackId callbackId) override;
65
66
 
66
67
  private:
68
+ void unpackMutations(
69
+ AnimationMutations &mutations,
70
+ std::unordered_map<SurfaceId, SurfaceUpdates> &surfaceUpdates,
71
+ std::set<SurfaceId> &asyncFlushSurfaces);
72
+ void applySurfaceUpdates(
73
+ std::unordered_map<SurfaceId, SurfaceUpdates> &surfaceUpdates,
74
+ const std::set<SurfaceId> &asyncFlushSurfaces);
75
+ void applyMutations(AnimationMutations mutations);
67
76
  std::vector<CallbackWithId> callbacks;
68
77
  std::shared_ptr<AnimatedPropsRegistry> animatedPropsRegistry_;
69
78
  std::shared_ptr<AnimationChoreographer> animationChoreographer_;
@@ -8,6 +8,7 @@
8
8
  #pragma once
9
9
 
10
10
  #include <react/renderer/uimanager/UIManagerAnimationBackend.h>
11
+ #include <react/timing/primitives.h>
11
12
 
12
13
  namespace facebook::react {
13
14
 
@@ -21,6 +22,10 @@ class AnimationChoreographer {
21
22
 
22
23
  virtual void resume() = 0;
23
24
  virtual void pause() = 0;
25
+ virtual AnimationTimestamp now() const
26
+ {
27
+ return HighResTimeStamp::now().toChronoSteadyClockTimePoint().time_since_epoch();
28
+ }
24
29
  void setAnimationBackend(std::weak_ptr<UIManagerAnimationBackend> animationBackend)
25
30
  {
26
31
  animationBackend_ = animationBackend;
@@ -31,6 +31,7 @@ class UIManagerAnimationBackend {
31
31
  virtual void stop(CallbackId callbackId) = 0;
32
32
  virtual void clearRegistry(SurfaceId surfaceId) = 0;
33
33
  virtual void trigger() = 0;
34
+ virtual void pushAnimationMutations(const Callback &callback) = 0;
34
35
  virtual void registerJSInvoker(std::shared_ptr<CallInvoker> jsInvoker) = 0;
35
36
  };
36
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.85.1",
3
+ "version": "0.85.2",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -149,7 +149,7 @@
149
149
  "featureflags": "node ./scripts/featureflags/index.js"
150
150
  },
151
151
  "peerDependencies": {
152
- "@react-native/jest-preset": "0.85.1",
152
+ "@react-native/jest-preset": "0.85.2",
153
153
  "@types/react": "^19.1.1",
154
154
  "react": "^19.2.3"
155
155
  },
@@ -162,13 +162,13 @@
162
162
  }
163
163
  },
164
164
  "dependencies": {
165
- "@react-native/assets-registry": "0.85.1",
166
- "@react-native/codegen": "0.85.1",
167
- "@react-native/community-cli-plugin": "0.85.1",
168
- "@react-native/gradle-plugin": "0.85.1",
169
- "@react-native/js-polyfills": "0.85.1",
170
- "@react-native/normalize-colors": "0.85.1",
171
- "@react-native/virtualized-lists": "0.85.1",
165
+ "@react-native/assets-registry": "0.85.2",
166
+ "@react-native/codegen": "0.85.2",
167
+ "@react-native/community-cli-plugin": "0.85.2",
168
+ "@react-native/gradle-plugin": "0.85.2",
169
+ "@react-native/js-polyfills": "0.85.2",
170
+ "@react-native/normalize-colors": "0.85.2",
171
+ "@react-native/virtualized-lists": "0.85.2",
172
172
  "abort-controller": "^3.0.0",
173
173
  "anser": "^1.4.9",
174
174
  "ansi-regex": "^5.0.0",