mpx-rn-style-guide

Document Mpx component styling best practices for React Native output.

3.9k|388|Updated Dec 6, 2018
One-click install
npx skills add https://github.com/didi/mpx --skill mpx-rn-style-guide
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mpx-rn-style-guide
Source: https://github.com/didi/mpx/tree/main/.agents/skills/mpx-rn-style-guide
Command: npx skills add https://github.com/didi/mpx --skill mpx-rn-style-guide

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance on adapting Mpx component styles for React Native output, addressing the differences between RN and mini-program styling systems to ensure cross-platform compatibility.

Core Features & Use Cases

  • Style Compatibility: Understand and resolve differences in selector and CSS property support between RN and mini-programs.
  • Unit Conversion: Learn how units like rpx, px, vw, vh, and percentages are handled in RN.
  • Layout Best Practices: Adopt recommended approaches for Flexbox, and avoid unsupported layout methods like Grid and Float.
  • Cross-Platform Development: Write styles that work seamlessly across Mpx's supported platforms, with specific advice for RN.
  • Use Case: When developing a Mpx application that targets both WeChat mini-programs and React Native, and you encounter styling issues on the RN platform, this Skill will guide you on how to fix them by explaining the underlying platform differences and providing solutions.

Quick Start

Explain the differences in CSS selector support between Mpx's RN and mini-program targets.

Frequently Asked Questions about mpx-rn-style-guide

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle CSS selector compatibility when styling Mpx components for React Native?

CSS selector compatibility for Mpx React Native styling differs from mini-programs due to RN's underlying rendering engine. This guide details those selector support differences to help you resolve cross-platform styling conflicts and ensure consistent component rendering.

What units are supported for cross-platform styling in Mpx React Native?

Cross-platform styling in Mpx React Native supports unit conversions for rpx, px, vw, vh, and percentages. This documentation explains how each unit is specifically handled and calculated within the RN environment to maintain visual consistency.

Does React Native support CSS Grid and Float layouts in Mpx cross-platform development?

React Native does not support CSS Grid and Float layouts in Mpx cross-platform development. You should adopt Flexbox as the primary layout method to ensure your components render correctly and maintain compatibility across both RN and mini-program platforms.

Why does text overflow behave differently in Mpx React Native compared to mini-programs?

Text overflow behaves differently in Mpx React Native because of underlying platform discrepancies in CSS property support. This guide provides specific best practices and solutions for handling text overflow, element hiding, and background properties correctly on RN.

What is the best way to write Mpx styles that target both WeChat mini-programs and React Native?

The best way to write cross-platform Mpx styles is to understand RN and mini-program styling differences, use Flexbox for layout, and apply conditional compilation. This approach ensures seamless adaptation across platforms while addressing specific RN constraints.

Can I use CSS transforms and animations in Mpx React Native output?

You can use CSS transforms and animations in Mpx React Native output, but they require specific cross-platform adaptation strategies. This documentation outlines the supported properties and provides guidance on resolving implementation differences for RN targets.