-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TM] Add spec for UIManager #24902
Closed
Closed
[TM] Add spec for UIManager #24902
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4bc2748
[TM] Add spec for UIManager
ericlewis 23f959f
drop incorrect comments
ericlewis df5082e
make these unchangeable for codegen
ericlewis 40653ba
okay…
ericlewis 26aaece
Remove unused check
ericlewis fecbd05
Be careful about collisions
ericlewis ce6adf9
Add setLayoutAnimationEnabledExperimental
ericlewis dd63f8b
cleanup
ericlewis b694ca9
Satisfy android
ericlewis dc77d65
use object
ericlewis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/** | ||
* 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'; | ||
|
||
export interface Spec extends TurboModule { | ||
+getConstants: () => Object; | ||
+getConstantsForViewManager: (viewManagerName: string) => Object; | ||
+getDefaultEventTypes: () => Array<string>; | ||
+playTouchSound: () => void; | ||
+lazilyLoadView: (name: string) => Object; // revisit return | ||
+createView: ( | ||
reactTag: number, | ||
viewName: string, | ||
rootTag: number, | ||
props: Object, | ||
) => void; | ||
+updateView: (reactTag: number, viewName: string, props: Object) => void; | ||
+focus: (reactTag: ?number) => void; | ||
+blur: (reactTag: ?number) => void; | ||
+findSubviewIn: ( | ||
reactTag: ?number, | ||
point: [number, number], | ||
callback: ( | ||
nativeViewTag: number, | ||
left: number, | ||
top: number, | ||
width: number, | ||
height: number, | ||
) => void, | ||
) => void; | ||
+dispatchViewManagerCommand: ( | ||
reactTag: ?number, | ||
commandID: number, | ||
commandArgs: ?Array<string | number | boolean>, // is this best? | ||
) => void; | ||
+measure: ( | ||
reactTag: ?number, | ||
callback: ( | ||
left: number, | ||
top: number, | ||
width: number, | ||
height: number, | ||
pageX: number, | ||
pageY: number, | ||
) => void, | ||
) => void; | ||
+measureInWindow: ( | ||
reactTag: number, | ||
callback: (result: Array<number>) => void, | ||
) => void; | ||
+viewIsDescendantOf: ( | ||
reactTag: number, | ||
ancestorReactTag: number, | ||
callback: (result: Array<boolean>) => void, | ||
) => void; | ||
+measureLayout: ( | ||
reactTag: number, | ||
ancestorReactTag: ?number, | ||
errorCallback: (error: Object) => void, | ||
callback: (result: Array<number>) => void, | ||
) => void; | ||
+measureLayoutRelativeToParent: ( | ||
reactTag: number, | ||
errorCallback: (error: Object) => void, | ||
callback: (result: Array<number>) => void, | ||
) => void; | ||
+setJSResponder: (reactTag: number, blockNativeResponder: boolean) => void; | ||
+clearJSResponder: () => void; | ||
+configureNextLayoutAnimation: ( | ||
config: Object, | ||
callback: () => void, // check what is returned here | ||
errorCallback: (error: Object) => void, | ||
) => void; | ||
+removeSubviewsFromContainerWithID: (containerID: number) => void; | ||
+replaceExistingNonRootView: (reactTag: number, newReactTag: number) => void; | ||
+setChildren: (containerTag: number, reactTags: Array<number>) => void; | ||
+manageChildren: ( | ||
containerTag: number, | ||
moveFromIndices: Array<number>, | ||
moveToIndices: Array<number>, | ||
addChildReactTags: Array<number>, | ||
addAtIndices: Array<number>, | ||
removeAtIndices: Array<number>, | ||
) => void; | ||
|
||
// android only | ||
+setLayoutAnimationEnabledExperimental: (enabled: boolean) => void; | ||
+sendAccessibilityEvent: (tag: number, eventType: number) => void; | ||
} | ||
|
||
export default TurboModuleRegistry.getEnforcing<Spec>('UIManager'); |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use strict-local and update references to Object which is implicit any?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thymikee object is a desired return result according to the issue filed. In codegen, I think it has a different meaning from any.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to use
{[key: string]: mixed}
instead of Object. I'm not sure what assumptions codegen is making, but I would expect it (sooner or later) to get data from Flow Type ASTThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, let's stick with
Object
. The internal codegen isn't very smart yet, so we can improve it over time later.