Skip to content

Commit 2bd34a2

Browse files
committed
fix(Modal): 调整明暗主题色
1 parent 065d34f commit 2bd34a2

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

packages/core/src/Grid/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export default function Grid(props: GridProps) {
9696
onPress,
9797
...otherProps
9898
} = props;
99+
const textColor = theme.colors.primary_text || '#ccc';
99100
if (!Array.isArray(data)) {
100101
return null;
101102
}
@@ -123,7 +124,9 @@ export default function Grid(props: GridProps) {
123124
const itemContent = (
124125
<Fragment>
125126
{icon && <MaybeTextOrView style={iconStyle}>{icon}</MaybeTextOrView>}
126-
<MaybeTextOrView style={[{ marginTop: 9, fontSize: 12 }, textStyle]}>{item.text}</MaybeTextOrView>
127+
<MaybeTextOrView style={[{ marginTop: 9, fontSize: 12, color: textColor }, textStyle]}>
128+
{item.text}
129+
</MaybeTextOrView>
127130
</Fragment>
128131
);
129132
childItem!.push(

packages/core/src/Modal/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { useState, useMemo, useRef } from 'react';
22
import { Animated, StyleSheet, LayoutChangeEvent, Dimensions, ViewStyle } from 'react-native';
33
import MaskLayer, { MaskLayerProps } from '../MaskLayer';
4+
import { Theme } from '../theme';
5+
import { useTheme } from '@shopify/restyle';
46

57
let MainWidth = Dimensions.get('window').width;
68
let MainHeight = Dimensions.get('window').height;
@@ -13,6 +15,7 @@ export interface ModalProps extends MaskLayerProps {
1315

1416
const Modal = (props: ModalProps = {}) => {
1517
const { onClosed, visible, children, placement = 'bottom', containerStyle, ...otherProps } = props;
18+
const theme = useTheme<Theme>();
1619
const AnimatedOpacity: Animated.Value = useRef(new Animated.Value(0)).current;
1720
// const [display] = useState<'none' | 'flex'>('none');
1821
let [layoutHeight, setLayoutHeight] = useState(0);
@@ -102,7 +105,12 @@ const Modal = (props: ModalProps = {}) => {
102105
// !layoutHeight && isVertical ? { display: display } : {},
103106
// !layoutWidth && isHorizontal ? { display: display } : {},
104107
// // getTransformStyle(),
105-
{ transform: [translateStyle], backgroundColor: '#fff', position: 'relative', zIndex: 10000 },
108+
{
109+
transform: [translateStyle],
110+
backgroundColor: theme.colors.mask || '#fff',
111+
position: 'relative',
112+
zIndex: 10000,
113+
},
106114
]}
107115
>
108116
{children}

packages/core/src/theme/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const lightTheme = createTheme({
103103
colors: {
104104
...palette,
105105
background: palette.gray50,
106-
mask: palette.gray600,
106+
mask: palette.white,
107107
border: palette.gray200,
108108
icon: palette.gray300,
109109
disabled: palette.gray200,
@@ -226,7 +226,7 @@ const darkPalette = {
226226
gray500: 'rgba(255, 255, 255, 0.8)',
227227
gray600: 'rgba(0, 0, 0, 0.4)',
228228
gray700: 'rgba(0, 0, 0, 0.04)',
229-
gray800: 'transparent',
229+
gray800: 'rgba(30, 30, 40, 0.7)',
230230
gray900: 'transparent',
231231
};
232232

@@ -235,7 +235,7 @@ const darkTheme: Theme = {
235235
colors: {
236236
...darkPalette,
237237
background: darkPalette.gray50,
238-
mask: darkPalette.gray600,
238+
mask: darkPalette.gray800,
239239
border: darkPalette.gray400,
240240
icon: darkPalette.gray300,
241241
disabled: darkPalette.gray200,

0 commit comments

Comments
 (0)