Skip to content

Commit

Permalink
Merge branch 'feat-react-template-compiler' of github.com:didi/mpx in…
Browse files Browse the repository at this point in the history
…to feat-react-template-compiler
  • Loading branch information
yandadaFreedom committed May 14, 2024
2 parents a75586c + ec530f1 commit dafa6e9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = function ({ print }) {
{
test: /^(display-multiple-items|snap-to-edge|easing-function)$/,
android: androidPropLog
},
}
],
event: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = function ({ print }) {
{
test: /^(space|decode)$/,
ios: iosPropLog,
android: androidPropLog,
android: androidPropLog
},
{
test: /^(selectable|space|decode|use-built-in)$/,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const JD_UNSUPPORTED_TAG_NAME_ARR = ['functional-page-navigator', 'live-pusher',
const QA_UNSUPPORTED_TAG_NAME_ARR = ['movable-view', 'movable-area', 'open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'cover-image']
// RN不支持的标签集合
const RN_UNSUPPORTED_TAG_NAME_ARR = ['movable-view', 'movable-area', 'open-data', 'official-account', 'editor', 'functional-page-navigator', 'live-player', 'live-pusher', 'ad', 'cover-image',
'checkbox','checkbox-group','radio','radio-group','switch','movable-area','movable-view','icon','progress','rich-text','form','label','picker','picker-view','picker-view-column','slider',
'audio','camera','video','canvas','cover-image','cover-view','match-media','page-container','root-portal','editor','keyboard-accessory','navigator','map']
'checkbox', 'checkbox-group', 'radio', 'radio-group', 'switch', 'movable-area', 'movable-view', 'icon', 'progress', 'rich-text', 'form', 'label', 'picker', 'picker-view', 'picker-view-column', 'slider',
'audio', 'camera', 'video', 'canvas', 'cover-image', 'cover-view', 'match-media', 'page-container', 'root-portal', 'editor', 'keyboard-accessory', 'navigator', 'map']

/**
* @param {function(object): function} print
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-plugin/lib/platform/template/wx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ module.exports = function getSpec ({ warn, error }) {
const tempModifierStr = Object.keys(modifierMap).join('.')
meta.modifierStr = tempModifierStr ? '.' + tempModifierStr : ''
return '@'
},
}
// ios (prefix) {
// const prefixMap = {
// bind: 'on',
Expand Down
14 changes: 4 additions & 10 deletions packages/webpack-plugin/lib/runtime/components/react/mpx-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,11 @@ export interface _ViewProps extends ViewProps {
bindtouchend?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
}

function getDefaultStyle(style: Array<ViewStyle> = []) {
const mergeStyle: ViewStyle = Object.assign({}, ...style)
if (mergeStyle.display === 'flex') {
mergeStyle.flexDirection = mergeStyle.flexDirection || 'row'
mergeStyle.flexShrink = mergeStyle.flexShrink || 1
}
return mergeStyle
const DEFAULT_STYLE = {
flexDirection: 'row',
flexShrink: 1
}


const _View:React.FC<_ViewProps & React.RefAttributes<any>> = React.forwardRef((props: _ViewProps, ref: React.ForwardedRef<any>) => {
const {
style,
Expand All @@ -39,7 +34,6 @@ const _View:React.FC<_ViewProps & React.RefAttributes<any>> = React.forwardRef((
...otherProps } = props
const [isHover, setIsHover] = React.useState(false)

const mergeStyle: ViewStyle = style ? getDefaultStyle(style) : {}
const dataRef = React.useRef<{
startTimestamp: number,
startTimer?: ReturnType<typeof setTimeout>
Expand Down Expand Up @@ -106,7 +100,7 @@ const _View:React.FC<_ViewProps & React.RefAttributes<any>> = React.forwardRef((
<View
ref={ref}
{...{...otherProps, ...innerTouchable}}
style={ [ mergeStyle, isHover && hoverStyle ] }
style={ [ DEFAULT_STYLE, style, isHover && hoverStyle ] }
>
{children}
</View>
Expand Down

0 comments on commit dafa6e9

Please sign in to comment.