搜索

PythonReactSEOPDF
GitHub Skill

mobile

Develop React Native or Flutter apps with native integrations. Use for mobile development, cross-platform code, or app optimization.

htlin222☆ 75 仓库 Stars4 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Mobile Development

Build cross-platform mobile applications.

When to Use

  • React Native development
  • Flutter development
  • Mobile performance issues
  • Native module integration
  • App store deployment

React Native

Component Structure
import React, { useState, useCallback } from "react";
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";

interface Props {
  title: string;
  onPress: () => void;
}

export function Button({ title, onPress }: Props) {
  const [pressed, setPressed] = useState(false);

  const handlePress = useCallback(() => {
    setPressed(true);
    onPress();
  }, [onPress]);

  return (
    <TouchableOpacity
      style={[styles.button, pressed && styles.pressed]}
      onPress={handlePress}
      activeOpacity={0.7}
    >
      <Text style={styles.text}>{title}</Text>
    </TouchableOpacity>
  );
}

const styles = StyleSheet.create({
  button: {
    backgroundColor: "#007AFF",
    padding: 16,
    borderRadius: 8,
  },
  pressed: {
    opacity: 0.8,
  },
  text: {
    color: "white",
    fontWeight: "600",
    textAlign: "center",
  },
});
Navigation
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";

type RootStackParamList = {
  Home: undefined;
  Details: { id: string };
};

const Stack = createNativeStackNavigator<RootStackParamList>();

function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Home" component={HomeScreen} />
        <Stack.Screen name="Details" component={DetailsScreen} />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

Flutter

Widget Structure
class MyButton extends StatelessWidget {
  final String title;
  final VoidCallback onPressed;

  const MyButton({
    Key? key,
    required this.title,
    required this.onPressed,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      onPressed: onPressed,
      style: ElevatedButton.styleFrom(
        padding: const EdgeInsets.all(16),
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(8),
        ),
      ),
      child: Text(title),
    );
  }
}

Performance Tips

  • Use FlatList/ListView for long lists
  • Memoize callbacks with useCallback
  • Avoid inline styles (use StyleSheet)
  • Lazy load screens and images
  • Profile with Flipper/DevTools

Common Patterns

Pattern React Native Flutter
State useState/Redux setState/Riverpod
Navigation React Navigation Navigator 2.0
HTTP fetch/axios http/dio
Storage AsyncStorage shared_preferences
Animations Animated/Reanimated AnimationController

Examples

Input: "Build a list screen" Action: Create FlatList with virtualization, pull-to-refresh, pagination

Input: "Add offline support" Action: Implement AsyncStorage caching, sync queue, network detection

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-03-11
索引更新时间
2026-03-11
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!