forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add spec for AnimatedModule (facebook#24911)
Summary: Part of facebook#24875. Added `strict-local` to the NativeModuleHelper btw. ## Changelog [General] [Added] - TM add spec for AnimatedModule Pull Request resolved: facebook#24911 Reviewed By: rickhanlonii Differential Revision: D15434114 Pulled By: fkgozali fbshipit-source-id: ea9215306ebf969795ce755270b8fdc14c52da9c
- Loading branch information
Showing
4 changed files
with
118 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* 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. | ||
* | ||
* @flow | ||
* @format | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type {TurboModule} from 'RCTExport'; | ||
import * as TurboModuleRegistry from 'TurboModuleRegistry'; | ||
|
||
type EndResult = {finished: boolean}; | ||
type EndCallback = (result: EndResult) => void; | ||
|
||
export type EventMapping = {| | ||
nativeEventPath: Array<string>, | ||
animatedValueTag: ?number, | ||
|}; | ||
|
||
export type AnimatedNodeConfig = {| | ||
// TODO: Type this with better enums. | ||
type: string, | ||
|}; | ||
|
||
export type AnimatingNodeConfig = {| | ||
// TODO: Type this with better enums. | ||
type: string, | ||
|}; | ||
|
||
export interface Spec extends TurboModule { | ||
+createAnimatedNode: (tag: ?number, config: AnimatedNodeConfig) => void; | ||
+startListeningToAnimatedNodeValue: (tag: ?number) => void; | ||
+stopListeningToAnimatedNodeValue: (tag: ?number) => void; | ||
+connectAnimatedNodes: (parentTag: ?number, childTag: ?number) => void; | ||
+disconnectAnimatedNodes: (parentTag: ?number, childTag: ?number) => void; | ||
+startAnimatingNode: ( | ||
animationId: ?number, | ||
nodeTag: ?number, | ||
config: AnimatingNodeConfig, | ||
endCallback: EndCallback, | ||
) => void; | ||
+stopAnimation: (animationId: ?number) => void; | ||
+setAnimatedNodeValue: (nodeTag: ?number, value: ?number) => void; | ||
+setAnimatedNodeOffset: (nodeTag: ?number, offset: ?number) => void; | ||
+flattenAnimatedNodeOffset: (nodeTag: ?number) => void; | ||
+extractAnimatedNodeOffset: (nodeTag: ?number) => void; | ||
+connectAnimatedNodeToView: (nodeTag: ?number, viewTag: ?number) => void; | ||
+disconnectAnimatedNodeFromView: (nodeTag: ?number, viewTag: ?number) => void; | ||
+dropAnimatedNode: (tag: ?number) => void; | ||
+addAnimatedEventToView: ( | ||
viewTag: ?number, | ||
eventName: string, | ||
eventMapping: EventMapping, | ||
) => void; | ||
+removeAnimatedEventFromView: ( | ||
viewTag: ?number, | ||
eventName: string, | ||
animatedNodeTag: ?number, | ||
) => void; | ||
|
||
// Events | ||
+addListener: (eventName: string) => void; | ||
+removeListeners: (count: number) => void; | ||
} | ||
|
||
export default TurboModuleRegistry.get<Spec>('NativeAnimatedModule'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters