-
Notifications
You must be signed in to change notification settings - Fork 382
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
feat: rn layout hook #1662
feat: rn layout hook #1662
Conversation
@@ -0,0 +1,31 @@ | |||
import { TextStyle } from 'react-native' | |||
import { Children, cloneElement } from 'react' |
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.
一起扔到utils里吧
textProps?: Record<string, any> | ||
} | ||
|
||
export function wrapChildren (props: Record<string, any> = {}, { hasVarDec, varContext }: WrapChildrenConfig, { textStyle, textProps } : TextConfig = {}) { |
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.
WrapChildrenConfig和TextConfig合成一个config就行
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.
mpx-view也可以调用这个方法,外部再去拼bgImage就可以,
}) | ||
} | ||
if (hasVarDec && varContext) { | ||
children = <VarContext.Provider value={varContext}>{children}</VarContext.Provider> |
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.
加个key
@@ -130,6 +130,16 @@ const useInnerProps = ( | |||
const propsRef = useRef<Record<string, any>>({}) | |||
const eventConfig: { [key: string]: string[] } = {} | |||
const config = rawConfig || { layoutRef: { current: {} }, disableTouch: false, disableTap: false } | |||
const removeProps = [ | |||
'enable-background', |
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.
children也可以包括进来吧
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.
style应该也可以
const hasLayoutRef = useRef(false) | ||
const layoutStyle: Record<string, any> = hasLayoutRef.current ? {} : DEFAULT_UNLAY_STYLE | ||
const layoutProps: Record<string, any> = {} | ||
if (hasSelfPercent || onLayout) { |
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.
这里还要判断一个props['enable-offset']
No description provided.