Skip to content

Instantly share code, notes, and snippets.

@skahack
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skahack/aa1214429747fa632359 to your computer and use it in GitHub Desktop.
Save skahack/aa1214429747fa632359 to your computer and use it in GitHub Desktop.

reactBridgeDidFinishTransaction

- (void)reactBridgeDidFinishTransaction

ReactがViewの計算をすべて終えたタイミングで実行される。TODO: Deprecate thisと宣言部分にあるので、廃止されるかもしれない。

// https://github.com/facebook/react-native/blob/c760ca90a58e246201aacfa673cadcdbf6d0dd57/React/Modules/RCTUIManager.h#L37-L41
/**
 * Update the frame of a root view. This might be in response to a screen rotation
 * or some other layout event outsde of the React-managed view hierarchy.
 */
- (void)setFrame:(CGRect)frame forRootView:(UIView *)rootView;


// https://github.com/facebook/react-native/blob/862d9fba09046b6ca82bcc75197de69cbfb8fa41/React/Base/RCTBridgeModule.h#L102-L105
/**
 * Notifies the module that a batch of JS method invocations has just completed.
 */
- (void)batchDidComplete;


// https://github.com/facebook/react-native/blob/862d9fba09046b6ca82bcc75197de69cbfb8fa41/React/Base/RCTBridge.h#L82-L89
/**
 * This method is used to execute a new application script. It is called
 * internally whenever a JS application bundle is loaded/reloaded, but should
 * probably not be used at any other time.
 */
- (void)enqueueApplicationScript:(NSString *)script
                             url:(NSURL *)url
                      onComplete:(RCTJavaScriptCompleteBlock)onComplete;

// https://github.com/facebook/react-native/blob/d937071517b47b3d2e54510a1f695885a27c5e52/React/Base/RCTBridge.m#L1061-L1064
/**
 * Private hack to support `setTimeout(fn, 0)`
 */
- (void)_immediatelyCallTimer:(NSNumber *)timer

// https://github.com/facebook/react-native/blob/d937071517b47b3d2e54510a1f695885a27c5e52/React/Modules/RCTTiming.m#L20-L23
/**
 * Allow super fast, one time, timers to skip the queue and be directly executed
 */
- (void)_immediatelyCallTimer:(NSNumber *)timer;

// https://github.com/facebook/react-native/blob/d937071517b47b3d2e54510a1f695885a27c5e52/React/Modules/RCTTiming.m#L158-L168
/**
 * There's a small difference between the time when we call
 * setTimeout/setInterval/requestAnimation frame and the time it actually makes
 * it here. This is important and needs to be taken into account when
 * calculating the timer's target time. We calculate this by passing in
 * Date.now() from JS and then subtracting that from the current time here.
 */
RCT_EXPORT_METHOD(createTimer:(NSNumber *)callbackID
                  duration:(NSTimeInterval)jsDuration
                  jsSchedulingTime:(NSDate *)jsSchedulingTime
                  repeats:(BOOL)repeats)

didUpdateFrame:update

- (void)didUpdateFrame:(RCTFrameUpdate *)update

CADisplayLink(スクリーンのリフレッシュ)のタイミングで実行される

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment