Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.

Commit b77e4b8

Browse files
committedApr 9, 2021
fix: 修复不兼容 Android 6.0 的问题
close #1522
1 parent 50aba47 commit b77e4b8

File tree

6 files changed

+29
-8
lines changed

6 files changed

+29
-8
lines changed
 

‎packages/remax-framework-shared/src/RuntimeOptions.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ function merge(...options: Array<Partial<RuntimeOptions>>) {
3737
acc.hostComponents[k] = acc.hostComponents[k] ?? {};
3838
acc.hostComponents[k].additional = inputHostComponent?.additional ?? acc.hostComponents[k].additional;
3939
acc.hostComponents[k].alias = Object.assign(acc.hostComponents[k].alias ?? {}, inputHostComponent?.alias ?? {});
40-
acc.hostComponents[k].props = Array.from(
41-
new Set([...(acc.hostComponents[k].props ?? []), ...(inputHostComponent?.props ?? [])])
42-
);
40+
acc.hostComponents[k].props = [
41+
...new Set([...(acc.hostComponents[k].props ?? []), ...(inputHostComponent?.props ?? [])]),
42+
];
4343
});
4444

4545
acc.pluginDriver = option.pluginDriver ?? acc.pluginDriver;

‎packages/remax-framework-shared/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ export * from './lifecycle';
1111
export * from './hooks';
1212
export * from './formatDisplayName';
1313
export * from './promisify';
14+
export * from './shim';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export function find<P>(list: P[], predicate: (value: P, i: number, list: P[]) => boolean) {
2+
for (let i = 0; i < list.length; i++) {
3+
const value = list[i];
4+
if (predicate(value, i, list)) {
5+
return value;
6+
}
7+
}
8+
}
9+
10+
export function includes<P>(list: P[], searchElement: any) {
11+
for (let i = 0; i < list.length; i++) {
12+
const value = list[i];
13+
if (value === searchElement) {
14+
return true;
15+
}
16+
}
17+
return false;
18+
}

‎packages/remax-runtime/src/SyntheticEvent/createCallbackProxy.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { find } from '@remax/framework-shared';
12
import stopPropagation, { validate as validatePropagation, isPropagationStopped } from './stopPropagation';
23
import { SYNTHETIC_TYPES, DEPRECATED_CATCH_TYPE } from './constants';
34
import VNode from '../VNode';
@@ -9,7 +10,7 @@ function isSyntheticType(inputType: string) {
910
);
1011
}
1112

12-
return !!SYNTHETIC_TYPES.find(type => type === inputType);
13+
return !!find(SYNTHETIC_TYPES, type => type === inputType);
1314
}
1415

1516
function createBaseSyntheticEvent(node: VNode, eventType: string, nativeEvent: any) {

‎packages/remax-runtime/src/hostConfig/diffProperties.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { includes } from '@remax/framework-shared';
12
const STYLE = ['style', 'placeholderStyle'];
23
const CHILDREN = 'children';
34
const CLASS_NAME = 'className';
@@ -26,7 +27,7 @@ export default function diffProperties(
2627
) {
2728
continue;
2829
}
29-
if (STYLE.includes(propKey)) {
30+
if (includes(STYLE, propKey)) {
3031
const lastStyle = lastProps[propKey];
3132
for (styleName in lastStyle) {
3233
if (hasOwnProperty.call(lastStyle, styleName)) {
@@ -49,7 +50,7 @@ export default function diffProperties(
4950
if (!hasOwnProperty.call(nextProps, propKey) || nextProp === lastProp || (nextProp == null && lastProp == null)) {
5051
continue;
5152
}
52-
if (STYLE.includes(propKey)) {
53+
if (includes(STYLE, propKey)) {
5354
if (process.env.NODE_ENV === 'development') {
5455
if (nextProp) {
5556
// Freeze the next style object so that we can assume it won't be

‎packages/remax-runtime/src/utils/plainStyle/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CSSProperties } from 'react';
22
import { isUnitlessNumber } from './CSSProperty';
3-
import { RuntimeOptions } from '@remax/framework-shared';
3+
import { find, RuntimeOptions } from '@remax/framework-shared';
44

55
const vendorPrefixes = ['webkit', 'moz', 'ms', 'o'];
66

@@ -19,7 +19,7 @@ const transformReactStyleKey = (key: string) => {
1919
const firstWord = styleValue.split('-').filter(s => s)[0];
2020
styleValue = styleValue.replace(/^-/, '');
2121

22-
if (vendorPrefixes.find(prefix => prefix === firstWord)) {
22+
if (find(vendorPrefixes, prefix => prefix === firstWord)) {
2323
styleValue = '-' + styleValue;
2424
}
2525
}

1 commit comments

Comments
 (1)
This repository has been archived.