From f6bb392569cf039b7230cb0287773d300147f0bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Sat, 25 Oct 2025 19:10:11 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20[Issues:=20#ID3I1E]=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9react-native-appearance=E6=8C=87=E5=AF=BC=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李琦 --- en/react-native-appearance.md | 53 ++++++++++++++++---------------- zh-cn/react-native-appearance.md | 38 +++++++++++++---------- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/en/react-native-appearance.md b/en/react-native-appearance.md index 6b388984..fe91c722 100644 --- a/en/react-native-appearance.md +++ b/en/react-native-appearance.md @@ -12,7 +12,7 @@

-> [!Tip] [Github Address](https://github.com/expo/react-native-appearance) +> [!Tip] [Github Address](https://github.com/react-native-oh-library/react-native-appearance) ## Installation and Usage @@ -23,13 +23,13 @@ Navigate to your project directory and enter the following command: #### **npm** ```bash -npm install react-native-appearance@0.3.5 +npm install @react-native-oh-tpl/react-native-appearance ``` #### **yarn** ```bash -yarn add react-native-appearance@0.3.5 +yarn add @react-native-oh-tpl/react-native-appearance ``` @@ -43,28 +43,24 @@ The following code demonstrates how to use this color picker component in a page ```tsx import React, { useState } from "react"; import { Button, View, Text, StyleSheet, useColorScheme } from 'react-native'; +import { Tester, TestSuite, TestCase } from '@rnoh/testerino'; import { AppearanceHarmony } from 'react-native-appearance'; -export default class App extends React.Component { - - // The user's preferred color scheme (e.g. Dark Mode). +const AppearanceExample = () => { const scheme = useColorScheme(); const currentScheme = scheme ?? scheme!.toString(); - // Add an event handler that is fired when appearance preferences change. const [listenedScheme, setListenedScheme] = useState(''); AppearanceHarmony.addChangeListener(({ colorScheme }) => { setListenedScheme(colorScheme ?? colorScheme!.toString()); }); - // Get the color scheme. const [gotScheme, setGotScheme] = useState(''); const getAppearance = ()=> { const result = AppearanceHarmony.getColorScheme(); setGotScheme(result ?? result!.toString()); } - // Set the color scheme preference. const changeAppearance = ()=> { const result = AppearanceHarmony.getColorScheme(); if (result == 'dark') { @@ -86,18 +82,21 @@ export default class App extends React.Component { } }); - render() { - return ( - - Current color scheme:{currentScheme} - Listening color scheme:{listenedScheme} - Get color scheme result:{gotScheme} -