英文:
How to customize React Native Paper Switch components for android?
问题
当我使用来自React Native Paper的这段代码时,我期望开关组件的外观与Material Design 3的开关完全相同,但不幸的是它并不是,并且看起来像旧版本的开关。我想知道如何自定义这个组件的外观,使其看起来像md3的React Native Paper开关。
import * as React from 'react';
import { Switch } from 'react-native-paper';
const MyComponent = () => {
const [isSwitchOn, setIsSwitchOn] = React.useState(false);
const onToggleSwitch = () => setIsSwitchOn(!isSwitchOn);
return <Switch value={isSwitchOn} onValueChange={onToggleSwitch} />;
};
export default MyComponent;
如果有人能帮助我,非常感谢
我无法将这个组件自定义为md3设计的外观。
英文:
When I use this code from react native paper I expect the switch component to be exactly look likse the **Material design 3 **switch, but unfortunately it is not and looks like older version, I was curios how to customize this component to looks like the md3react native paper switch
Official docs of MD3
import * as React from 'react';
import { Switch } from 'react-native-paper';
const MyComponent = () => {
const [isSwitchOn, setIsSwitchOn] = React.useState(false);
const onToggleSwitch = () => setIsSwitchOn(!isSwitchOn);
return <Switch value={isSwitchOn} onValueChange={onToggleSwitch} />;
};
export default MyComponent;
if anyone can help me, much appreciated
I could not custmize this comonent to look like md3 design
答案1
得分: 0
目前,React Native Paper不支持Switch组件的MD3。你可以在以下链接中找到相关讨论:
https://github.com/callstack/react-native-paper/issues/3689#issuecomment-1436567611
https://github.com/callstack/react-native-paper/issues/3797
英文:
Currently, React Native Paper doesn't support MD3 for the Switch component
https://github.com/callstack/react-native-paper/issues/3689#issuecomment-1436567611
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论