Loading...
Loading...
Style Compatibility and Adaptation Development Guide for Mpx Cross-Platform Output to RN (Mpx2RN or Mpx2DRN). This guide must be invoked when users ask questions related to Mpx cross-platform output to RN styles, including: Mpx2RN style adaptation, Mpx2RN style compatibility transformation, Mpx2RN style capability support, Mpx2RN style not taking effect, Mpx2RN style errors, Mpx2RN style development best practices, how to achieve a certain style effect in Mpx2RN, etc.
npx skill4agent add didi/mpx mpx-rn-style-guide.mpx{name}.mpx{name}.mpx.list .item.list-item<template><script>createSelectorQuery<style> .list .item { color: red; } </style><style> .list-item { color: red; } </style>wx:stylewx:class{{}}styleclass<view class="item {{isActive ? 'active' : ''}}"><view class="item" wx:class="{{ {active: isActive} }}">/*use rpx*//*use px*/<style>sasslessstylus.list {
.item {
color: red;
&.active {
color: blue;
}
}
}.list .item { color: red; }
.list .item.active { color: blue; }<style><template><script><!-- Recommended: Directly use equivalent single class names and use wx:class for dynamic binding -->
<view class="list-item" wx:class="{{ { 'list-item-active': isActive } }}">
<text class="title">Title</text>
</view>/* Recommended to use single class selectors, avoid descendant selectors and intersection selectors */
.list-item { padding: 20rpx; }
.list-item-active { color: red; }todo/* @mpx-if (__mpx_mode__ === 'wx' || __mpx_mode__ === 'ali' || __mpx_mode__ === 'web') */
/* todo: RN does not support adjacent sibling selectors, retained only in the original platform */
.item + .item { margin-top: 10rpx; }
/* @mpx-endif */<style><template><script>.mask {
/* @mpx-if (__mpx_mode__ === 'ios' || __mpx_mode__ === 'android' || __mpx_mode__ === 'harmony') */
flex: 0;
height: 0;
width: 0;
padding: 0;
margin: 0;
overflow: hidden;
/* @mpx-else */
display: none;
/* @mpx-endif */
}todo.animation-box {
/* @mpx-if (__mpx_mode__ === 'wx' || __mpx_mode__ === 'ali' || __mpx_mode__ === 'web') */
/* todo: RN does not support keyframe animations, retained only in the original platform */
animation: slideIn 0.5s ease-in-out;
/* @mpx-endif */
}<style><style><style><template><script><style><template><script>