Error changing ActivityIndicator color
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- react-native, typescript
- 领域
- mobile
调研方向
Start by reproducing the reported ActivityIndicator example through the createRestyleComponent entry point and inspect how the color prop is handled. Confirm the expected behavior when color="green1" is passed, and consider the issue done when the native indicator visibly uses the theme color.
由索引模型根据 Issue 内容生成。
描述
I believe there is a bug when using the ActivityIndicator component, when using restyle the color does not change.
My Theme:
import {createTheme} from '@shopify/restyle';
const palette = {
black1: '#101010',
black2: '#2D2D2D',
black3: '#585858',
black4: '#9F9F9F',
black5: '#CFCFCF',
black6: '#E7E7E7',
green1: '#4FAF5A',
green2: '#84C78C',
green3: '#B9DFBD',
red1: '#E03F3F',
red2: '#E97979',
red3: '#F3B2B2',
background: '#F1F1F1',
white: '#FFFFFF',
};
export const theme = createTheme({
colors: {
...palette,
primary: palette.green1,
primaryContrast: palette.white,
background: palette.background,
sucess: palette.green1,
error: palette.red1,
},
spacing: {
s4: 4,
s8: 8,
s12: 12,
s16: 16,
s20: 20,
s24: 24,
s32: 32,
s40: 40,
},
textVariants: {
defaults: {},
},
borderRadii: {
br4: 4,
br8: 8,
br12: 12,
br16: 16,
br20: 20,
br24: 24,
br32: 32,
br40: 40,
},
});
export type Theme = typeof theme;
Component:
import {
createRestyleComponent,
BackgroundColorProps,
SpacingProps,
spacing,
ColorProps,
} from '@shopify/restyle';
import {
ActivityIndicatorProps as RNActivityIndicatorProps,
ActivityIndicator as RNActivityIndicator,
} from 'react-native';
import {theme, Theme} from '../../theme/theme';
interface ActIndiProps extends RNActivityIndicatorProps {
}
type ActivityIndicatorProps = BackgroundColorProps<Theme> &
ColorProps<Theme> &
SpacingProps<Theme> &
ActIndiProps;
export const ActivityIndicator = createRestyleComponent<
ActivityIndicatorProps,
Theme
>([spacing], ({color, ...rest}: ActivityIndicatorProps) => {
return <RNActivityIndicator {...rest} color={color} />;
});
Example usage:
function App() {
const [email, setEmail] = useState('');
const [error, setError] = useState(false);
return (
<ThemeProvider theme={theme}>
<TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
<SafeAreaView style={{flex: 1}}>
<View
style={{
flex: 1,
paddingHorizontal: 24,
}}>
<ActivityIndicator color="green1" size="large" />
</View>
</SafeAreaView>
</TouchableWithoutFeedback>
</ThemeProvider>
);
}
export default App;
- 主要语言
- TypeScript
- 星标
- 3.4k
- 派生
- 154
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Shopify/restyle 的其他 Issue
-
Reanimated 4.4.x animated components conflict with Restyle theme可能已有人在做 @KAMRONBEK 于 131 天前认领。 未关闭bug
难度 3/5 1-2 天 新手友好度 55/100
-
bug
难度 1/5 1 小时以内 新手友好度 15/100
-
bug
难度 3/5 1-2 天 新手友好度 25/100
-
bug
难度 3/5 1-2 天 新手友好度 35/100
-
bug
难度 3/5 1-2 天 新手友好度 35/100
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 75/100
testing-library/jest-dom#749 ·
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 80/100
zed-industries/delta-claude#50 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
CDLUC3/dmptool-doc#660 ·
-
难度 1/5 1 小时以内 新手友好度 72/100
stripe/stripe-terminal-react-native#1162 ·
维护者通常 1 天内回复