mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
774dec1e17
Summary: iOS will need to be implemented separately, but the shared C++ bits are in place. Explanation: there is currently no way for the View layer to /know/ if an UpdateState call has succeeded or failed. Generally we just assume it succeeds, but if it fails we have no way of knowing or retrying. This can cause some UI bugs. To mitigate this, I'm introducing a "failure" notification callback mechanism. The JNI bridging for this is a little complicated to avoid passing Runnable across the JNI, but it should be much simpler on iOS. In development this seems to make View components much more reliable. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D22940187 fbshipit-source-id: 917f2932ae22d421f91fe8f4fca3f07dc089f820
33 lines
714 B
C++
33 lines
714 B
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <functional>
|
|
|
|
#include <react/renderer/core/StateData.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
class ShadowNodeFamily;
|
|
using SharedShadowNodeFamily = std::shared_ptr<ShadowNodeFamily const>;
|
|
|
|
class StateUpdate {
|
|
public:
|
|
using Callback =
|
|
std::function<StateData::Shared(StateData::Shared const &data)>;
|
|
using FailureCallback = std::function<void()>;
|
|
|
|
SharedShadowNodeFamily family;
|
|
Callback callback;
|
|
FailureCallback failureCallback;
|
|
};
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|