@momo-kits/foundation 0.92.6-rc.22 → 0.92.6-rc.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Application/Components.tsx +7 -4
- package/Application/types.ts +2 -2
- package/Application/utils.tsx +1 -5
- package/Button/index.tsx +5 -5
- package/Layout/Screen.tsx +13 -9
- package/package.json +1 -1
|
@@ -183,15 +183,18 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
183
183
|
|
|
184
184
|
const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
185
185
|
image,
|
|
186
|
-
backgroundColor,
|
|
187
186
|
animatedValue,
|
|
188
|
-
|
|
187
|
+
useSurface = false,
|
|
189
188
|
}) => {
|
|
190
189
|
const {theme} = useContext(ApplicationContext);
|
|
191
190
|
let headerImage = theme.assets?.headerBackground;
|
|
191
|
+
let backgroundColor;
|
|
192
192
|
if (image === null) {
|
|
193
193
|
headerImage = undefined;
|
|
194
194
|
}
|
|
195
|
+
if (useSurface) {
|
|
196
|
+
backgroundColor = theme.colors.background.default;
|
|
197
|
+
}
|
|
195
198
|
const opacity = animatedValue?.interpolate({
|
|
196
199
|
inputRange: [0, 114],
|
|
197
200
|
outputRange: [0, 1],
|
|
@@ -203,9 +206,9 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
|
203
206
|
style={[
|
|
204
207
|
Styles.flex,
|
|
205
208
|
{
|
|
206
|
-
backgroundColor
|
|
209
|
+
backgroundColor,
|
|
207
210
|
overflow: 'hidden',
|
|
208
|
-
borderBottomWidth:
|
|
211
|
+
borderBottomWidth: useSurface ? 1 : 0,
|
|
209
212
|
borderColor: theme.colors.border.default,
|
|
210
213
|
opacity,
|
|
211
214
|
},
|
package/Application/types.ts
CHANGED
|
@@ -165,9 +165,8 @@ export interface HeaderBackProps extends NavigationButtonProps {
|
|
|
165
165
|
|
|
166
166
|
export type HeaderBackgroundProps = {
|
|
167
167
|
image?: string | null;
|
|
168
|
-
backgroundColor?: string | null;
|
|
169
168
|
animatedValue?: Animated.Value;
|
|
170
|
-
|
|
169
|
+
useSurface?: boolean;
|
|
171
170
|
};
|
|
172
171
|
|
|
173
172
|
export type TitleCustomProps = {
|
|
@@ -223,4 +222,5 @@ export type FloatingButtonProps = {
|
|
|
223
222
|
export type AnimatedHeader = {
|
|
224
223
|
type: 'default' | 'surface';
|
|
225
224
|
component?: (props?: any) => React.ReactElement;
|
|
225
|
+
headerTitle?: (props?: any) => React.ReactElement;
|
|
226
226
|
};
|
package/Application/utils.tsx
CHANGED
|
@@ -100,11 +100,7 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
|
|
|
100
100
|
...options,
|
|
101
101
|
headerTintColor: theme.colors.text.default,
|
|
102
102
|
headerBackground: () => (
|
|
103
|
-
<HeaderBackground
|
|
104
|
-
image={null}
|
|
105
|
-
backgroundColor={theme.colors.background.surface}
|
|
106
|
-
useBorder={true}
|
|
107
|
-
/>
|
|
103
|
+
<HeaderBackground image={null} useSurface={true} />
|
|
108
104
|
),
|
|
109
105
|
};
|
|
110
106
|
} else {
|
package/Button/index.tsx
CHANGED
|
@@ -58,7 +58,7 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
58
58
|
/**
|
|
59
59
|
* If true, the icon of button will use the tint color provided by its container.
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
tintColor?: string;
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* If true, the icon of button will use be show indicator loading.
|
|
@@ -76,7 +76,7 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
76
76
|
const Button: FC<ButtonProps> = ({
|
|
77
77
|
type = 'primary',
|
|
78
78
|
size = 'large',
|
|
79
|
-
|
|
79
|
+
tintColor = null,
|
|
80
80
|
full = true,
|
|
81
81
|
iconRight,
|
|
82
82
|
iconLeft,
|
|
@@ -231,7 +231,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
231
231
|
const renderLeading = () => {
|
|
232
232
|
const iconSize = getIconSize();
|
|
233
233
|
const marginRight = getIconSpace();
|
|
234
|
-
const color =
|
|
234
|
+
const color = tintColor ?? getTextColor();
|
|
235
235
|
|
|
236
236
|
if (loading) {
|
|
237
237
|
return (
|
|
@@ -245,7 +245,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
245
245
|
borderRadius: Spacing.M,
|
|
246
246
|
},
|
|
247
247
|
]}>
|
|
248
|
-
<Loader type="spinner" color={
|
|
248
|
+
<Loader type="spinner" color={getTextColor()} />
|
|
249
249
|
</View>
|
|
250
250
|
);
|
|
251
251
|
}
|
|
@@ -266,7 +266,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
266
266
|
* render trailing
|
|
267
267
|
*/
|
|
268
268
|
const renderTrailing = () => {
|
|
269
|
-
const color =
|
|
269
|
+
const color = tintColor ?? getTextColor();
|
|
270
270
|
const marginLeft = getIconSpace();
|
|
271
271
|
|
|
272
272
|
if (iconRight) {
|
package/Layout/Screen.tsx
CHANGED
|
@@ -158,18 +158,27 @@ const Screen = forwardRef(
|
|
|
158
158
|
};
|
|
159
159
|
if (animatedHeader.type == 'surface') {
|
|
160
160
|
styleAnimatedHeader = {
|
|
161
|
-
|
|
161
|
+
...styleAnimatedHeader,
|
|
162
162
|
headerBackground: (props: any) => (
|
|
163
163
|
<HeaderBackground
|
|
164
164
|
{...props}
|
|
165
165
|
image={null}
|
|
166
|
-
|
|
167
|
-
useBorder={true}
|
|
166
|
+
useSurface={true}
|
|
168
167
|
animatedValue={animatedValue.current}
|
|
169
168
|
/>
|
|
170
169
|
),
|
|
171
170
|
};
|
|
172
171
|
}
|
|
172
|
+
if (animatedHeader.headerTitle) {
|
|
173
|
+
styleAnimatedHeader = {
|
|
174
|
+
...styleAnimatedHeader,
|
|
175
|
+
headerTitle: (props: any) =>
|
|
176
|
+
animatedHeader.headerTitle?.({
|
|
177
|
+
...props,
|
|
178
|
+
animatedValue: animatedValue.current,
|
|
179
|
+
}),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
173
182
|
navigation?.setOptions(styleAnimatedHeader);
|
|
174
183
|
}
|
|
175
184
|
}, [animatedHeader]);
|
|
@@ -192,12 +201,7 @@ const Screen = forwardRef(
|
|
|
192
201
|
headerShown: true,
|
|
193
202
|
headerTintColor: theme.colors.text.default,
|
|
194
203
|
headerBackground: (props: any) => (
|
|
195
|
-
<HeaderBackground
|
|
196
|
-
{...props}
|
|
197
|
-
image={null}
|
|
198
|
-
backgroundColor={theme.colors.background.surface}
|
|
199
|
-
useBorder={true}
|
|
200
|
-
/>
|
|
204
|
+
<HeaderBackground {...props} image={null} useSurface={true} />
|
|
201
205
|
),
|
|
202
206
|
headerTitle: (props: any) => <HeaderTitle {...props} />,
|
|
203
207
|
};
|