@mpxjs/core 2.10.1 → 2.10.3-beta.1
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/@types/index.d.ts +2 -1
- package/package.json +3 -3
- package/src/convertor/convertor.js +2 -1
- package/src/convertor/getConvertMode.js +2 -1
- package/src/core/mergeOptions.js +37 -0
- package/src/core/proxy.js +2 -2
- package/src/core/transferOptions.js +4 -0
- package/src/platform/builtInMixins/index.js +10 -2
- package/src/platform/builtInMixins/pageIdMixin.js +13 -0
- package/src/platform/builtInMixins/pageIdMixin.web.js +25 -0
- package/src/platform/builtInMixins/styleHelperMixin.ios.js +8 -1
- package/src/platform/createApp.ios.js +43 -15
- package/src/platform/env/vuePlugin.js +4 -0
- package/src/platform/patch/getDefaultOptions.ios.js +114 -69
- package/src/platform/patch/getDefaultOptions.web.js +2 -1
- package/src/platform/patch/react/getDefaultOptions.ios.js +0 -0
- package/LICENSE +0 -433
package/@types/index.d.ts
CHANGED
|
@@ -119,7 +119,8 @@ interface Context {
|
|
|
119
119
|
selectComponent: ReplaceWxComponentIns['selectComponent']
|
|
120
120
|
selectAllComponents: ReplaceWxComponentIns['selectAllComponents']
|
|
121
121
|
createSelectorQuery: WechatMiniprogram.Component.InstanceMethods<Record<string, any>>['createSelectorQuery']
|
|
122
|
-
createIntersectionObserver: WechatMiniprogram.Component.InstanceMethods<Record<string, any>>['createIntersectionObserver']
|
|
122
|
+
createIntersectionObserver: WechatMiniprogram.Component.InstanceMethods<Record<string, any>>['createIntersectionObserver'],
|
|
123
|
+
getPageId: WechatMiniprogram.Component.InstanceMethods<Record<string, any>>['getPageId']
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
interface ComponentOpt<D extends Data, P extends Properties, C, M extends Methods, Mi extends Array<any>, S extends Record<any, any>> extends Partial<WechatMiniprogram.Component.Lifetimes & WechatMiniprogram.Component.OtherOption> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/core",
|
|
3
|
-
"version": "2.10.1",
|
|
3
|
+
"version": "2.10.3-beta.1",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"main": "src/index.js",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@mpxjs/utils": "^2.10.
|
|
22
|
+
"@mpxjs/utils": "^2.10.2",
|
|
23
23
|
"lodash": "^4.1.1",
|
|
24
24
|
"miniprogram-api-typings": "^3.10.0"
|
|
25
25
|
},
|
|
@@ -109,5 +109,5 @@
|
|
|
109
109
|
"url": "https://github.com/didi/mpx/issues"
|
|
110
110
|
},
|
|
111
111
|
"sideEffects": false,
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "2d37697869b9bdda3efab92dda8c910b68fd05c0"
|
|
113
113
|
}
|
|
@@ -37,7 +37,8 @@ const rulesMap = {
|
|
|
37
37
|
wxToDd: extend({}, defaultConvertRule, wxToDdRule),
|
|
38
38
|
wxToJd: extend({}, defaultConvertRule, wxToJdRule),
|
|
39
39
|
wxToIos: extend({}, defaultConvertRule, wxToReactRule),
|
|
40
|
-
wxToAndroid: extend({}, defaultConvertRule, wxToReactRule)
|
|
40
|
+
wxToAndroid: extend({}, defaultConvertRule, wxToReactRule),
|
|
41
|
+
wxToHarmony: extend({}, defaultConvertRule, wxToReactRule)
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export function getConvertRule (convertMode) {
|
package/src/core/mergeOptions.js
CHANGED
|
@@ -2,6 +2,8 @@ import { getConvertRule } from '../convertor/convertor'
|
|
|
2
2
|
import builtInKeysMap from '../platform/patch/builtInKeysMap'
|
|
3
3
|
import { implemented } from './implement'
|
|
4
4
|
import {
|
|
5
|
+
isArray,
|
|
6
|
+
isFunction,
|
|
5
7
|
isObject,
|
|
6
8
|
aliasReplace,
|
|
7
9
|
makeMap,
|
|
@@ -221,6 +223,10 @@ function mergeMixins (parent, child) {
|
|
|
221
223
|
mergeToArray(parent, child, key)
|
|
222
224
|
} else if (/^behaviors|externalClasses$/.test(key)) {
|
|
223
225
|
mergeArray(parent, child, key)
|
|
226
|
+
} else if (key === 'inject') {
|
|
227
|
+
mergeInject(parent, child, key)
|
|
228
|
+
} else if (key === 'provide') {
|
|
229
|
+
mergeProvide(parent, child, key)
|
|
224
230
|
} else if (key !== 'mixins' && key !== 'mpxCustomKeysForBlend') {
|
|
225
231
|
// 收集非函数的自定义属性,在Component创建的页面中挂载到this上,模拟Page创建页面的表现,swan当中component构造器也能自动挂载自定义数据,不需要框架模拟挂载
|
|
226
232
|
if (curType === 'blend' && typeof child[key] !== 'function' && !builtInKeysMap[key] && __mpx_mode__ !== 'swan') {
|
|
@@ -277,6 +283,37 @@ function mergeDataFn (parent, child, key) {
|
|
|
277
283
|
}
|
|
278
284
|
}
|
|
279
285
|
|
|
286
|
+
function normalizeInject (options) {
|
|
287
|
+
const injectOpt = options.inject
|
|
288
|
+
if (isArray(injectOpt)) {
|
|
289
|
+
const normalized = (options.inject = {})
|
|
290
|
+
for (let i = 0; i < injectOpt.length; i++) {
|
|
291
|
+
normalized[injectOpt[i]] = injectOpt[i]
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function mergeInject (parent, child, key) {
|
|
297
|
+
normalizeInject(child)
|
|
298
|
+
mergeShallowObj(parent, child, key)
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function mergeProvide (parent, child, key) {
|
|
302
|
+
const parentVal = parent[key]
|
|
303
|
+
const childVal = child[key]
|
|
304
|
+
if (!parentVal) {
|
|
305
|
+
parent[key] = childVal
|
|
306
|
+
} else if (!childVal) {
|
|
307
|
+
parent[key] = parentVal
|
|
308
|
+
} else {
|
|
309
|
+
parent[key] = function mergedProvide () {
|
|
310
|
+
const to = isFunction(parentVal) ? parentVal.call(this) : parentVal
|
|
311
|
+
const from = isFunction(childVal) ? childVal.call(this) : childVal
|
|
312
|
+
return Object.assign(to, from)
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
280
317
|
export function mergeArray (parent, child, key) {
|
|
281
318
|
const childVal = child[key]
|
|
282
319
|
if (!parent[key]) {
|
package/src/core/proxy.js
CHANGED
|
@@ -101,7 +101,6 @@ function preProcessRenderData (renderData) {
|
|
|
101
101
|
})
|
|
102
102
|
return processedRenderData
|
|
103
103
|
}
|
|
104
|
-
|
|
105
104
|
export default class MpxProxy {
|
|
106
105
|
constructor (options, target, reCreated) {
|
|
107
106
|
this.target = target
|
|
@@ -317,7 +316,8 @@ export default class MpxProxy {
|
|
|
317
316
|
selectComponent: this.target.selectComponent.bind(this.target),
|
|
318
317
|
selectAllComponents: this.target.selectAllComponents.bind(this.target),
|
|
319
318
|
createSelectorQuery: this.target.createSelectorQuery ? this.target.createSelectorQuery.bind(this.target) : envObj.createSelectorQuery.bind(envObj),
|
|
320
|
-
createIntersectionObserver: this.target.createIntersectionObserver ? this.target.createIntersectionObserver.bind(this.target) : envObj.createIntersectionObserver.bind(envObj)
|
|
319
|
+
createIntersectionObserver: this.target.createIntersectionObserver ? this.target.createIntersectionObserver.bind(this.target) : envObj.createIntersectionObserver.bind(envObj),
|
|
320
|
+
getPageId: this.target.getPageId.bind(this.target)
|
|
321
321
|
}
|
|
322
322
|
])
|
|
323
323
|
if (!isObject(setupResult)) {
|
|
@@ -18,6 +18,10 @@ export default function transferOptions (options, type, needConvert = true) {
|
|
|
18
18
|
if (!options.__nativeRender__) {
|
|
19
19
|
options = mergeInjectedMixins(options, type)
|
|
20
20
|
}
|
|
21
|
+
if (currentInject && currentInject.injectProperties) {
|
|
22
|
+
// 编译属性注入
|
|
23
|
+
options.properties = Object.assign({}, currentInject.injectProperties, options.properties)
|
|
24
|
+
}
|
|
21
25
|
if (currentInject && currentInject.injectComputed) {
|
|
22
26
|
// 编译计算属性注入
|
|
23
27
|
options.computed = Object.assign({}, currentInject.injectComputed, options.computed)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isReact } from '@mpxjs/utils'
|
|
1
2
|
import pageStatusMixin from './pageStatusMixin'
|
|
2
3
|
import proxyEventMixin from './proxyEventMixin'
|
|
3
4
|
import renderHelperMixin from './renderHelperMixin'
|
|
@@ -13,10 +14,11 @@ import pageRouteMixin from './pageRouteMixin'
|
|
|
13
14
|
import { dynamicRefsMixin, dynamicRenderHelperMixin, dynamicSlotMixin } from '../../dynamic/dynamicRenderMixin.empty'
|
|
14
15
|
import styleHelperMixin from './styleHelperMixin'
|
|
15
16
|
import directiveHelperMixin from './directiveHelperMixin'
|
|
17
|
+
import pageIdMixin from './pageIdMixin'
|
|
16
18
|
|
|
17
19
|
export default function getBuiltInMixins ({ type, rawOptions = {} }) {
|
|
18
20
|
let bulitInMixins
|
|
19
|
-
if (
|
|
21
|
+
if (isReact) {
|
|
20
22
|
bulitInMixins = [
|
|
21
23
|
proxyEventMixin(),
|
|
22
24
|
directiveHelperMixin(),
|
|
@@ -36,7 +38,8 @@ export default function getBuiltInMixins ({ type, rawOptions = {} }) {
|
|
|
36
38
|
getTabBarMixin(type),
|
|
37
39
|
pageRouteMixin(type),
|
|
38
40
|
// 由于relation可能是通过mixin注入的,不能通过当前的用户options中是否存在relations来简单判断是否注入该项mixin
|
|
39
|
-
relationsMixin(type)
|
|
41
|
+
relationsMixin(type),
|
|
42
|
+
pageIdMixin(type)
|
|
40
43
|
]
|
|
41
44
|
} else {
|
|
42
45
|
// 此为差异抹平类mixins,原生模式下也需要注入也抹平平台差异
|
|
@@ -46,6 +49,11 @@ export default function getBuiltInMixins ({ type, rawOptions = {} }) {
|
|
|
46
49
|
refsMixin(),
|
|
47
50
|
relationsMixin(type)
|
|
48
51
|
]
|
|
52
|
+
if (__mpx_mode__ === 'ali') {
|
|
53
|
+
bulitInMixins = bulitInMixins.concat([
|
|
54
|
+
pageIdMixin(type)
|
|
55
|
+
])
|
|
56
|
+
}
|
|
49
57
|
// 此为纯增强类mixins,原生模式下不需要注入
|
|
50
58
|
if (!rawOptions.__nativeRender__) {
|
|
51
59
|
bulitInMixins = bulitInMixins.concat([
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
let pageId = 0
|
|
2
|
+
|
|
3
|
+
export default function pageIdMixin (mixinType) {
|
|
4
|
+
const mixin = {}
|
|
5
|
+
|
|
6
|
+
if (mixinType === 'page') {
|
|
7
|
+
Object.assign(mixin, {
|
|
8
|
+
beforeCreate () {
|
|
9
|
+
this.__pageId = ++pageId
|
|
10
|
+
},
|
|
11
|
+
provide () {
|
|
12
|
+
return {
|
|
13
|
+
__pageId: this.__pageId
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
if (mixinType === 'component') {
|
|
19
|
+
Object.assign(mixin, {
|
|
20
|
+
inject: ['__pageId']
|
|
21
|
+
})
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return mixin
|
|
25
|
+
}
|
|
@@ -195,7 +195,14 @@ export default function styleHelperMixin () {
|
|
|
195
195
|
|
|
196
196
|
if (hide) {
|
|
197
197
|
Object.assign(result, {
|
|
198
|
-
display: 'none'
|
|
198
|
+
// display: 'none'
|
|
199
|
+
// RN下display:'none'容易引发未知异常问题,使用布局样式模拟
|
|
200
|
+
flex: 0,
|
|
201
|
+
height: 0,
|
|
202
|
+
width: 0,
|
|
203
|
+
padding: 0,
|
|
204
|
+
margin: 0,
|
|
205
|
+
overflow: 'hidden'
|
|
199
206
|
})
|
|
200
207
|
}
|
|
201
208
|
|
|
@@ -10,8 +10,8 @@ import { initAppProvides } from './export/inject'
|
|
|
10
10
|
|
|
11
11
|
const appHooksMap = makeMap(mergeLifecycle(LIFECYCLE).app)
|
|
12
12
|
|
|
13
|
-
function
|
|
14
|
-
return window.width
|
|
13
|
+
function getPageSize (window = ReactNative.Dimensions.get('window')) {
|
|
14
|
+
return window.width + 'x' + window.height
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function filterOptions (options, appData) {
|
|
@@ -56,16 +56,22 @@ export default function createApp (options) {
|
|
|
56
56
|
const Stack = createStackNavigator()
|
|
57
57
|
const getPageScreens = (initialRouteName, initialParams) => {
|
|
58
58
|
return Object.entries(pages).map(([key, item]) => {
|
|
59
|
+
const options = {
|
|
60
|
+
// __mpxPageStatusMap 为编译注入的全局变量
|
|
61
|
+
headerShown: !(Object.assign({}, global.__mpxPageConfig, global.__mpxPageConfigsMap[key]).navigationStyle === 'custom')
|
|
62
|
+
}
|
|
59
63
|
if (key === initialRouteName) {
|
|
60
64
|
return createElement(Stack.Screen, {
|
|
61
65
|
name: key,
|
|
62
66
|
component: item,
|
|
63
|
-
initialParams
|
|
67
|
+
initialParams,
|
|
68
|
+
options
|
|
64
69
|
})
|
|
65
70
|
}
|
|
66
71
|
return createElement(Stack.Screen, {
|
|
67
72
|
name: key,
|
|
68
|
-
component: item
|
|
73
|
+
component: item,
|
|
74
|
+
options
|
|
69
75
|
})
|
|
70
76
|
})
|
|
71
77
|
}
|
|
@@ -154,7 +160,9 @@ export default function createApp (options) {
|
|
|
154
160
|
}
|
|
155
161
|
} else if (currentState === 'inactive' || currentState === 'background') {
|
|
156
162
|
global.__mpxAppCbs.hide.forEach((cb) => {
|
|
157
|
-
cb(
|
|
163
|
+
cb({
|
|
164
|
+
reason: 3
|
|
165
|
+
})
|
|
158
166
|
})
|
|
159
167
|
const navigation = getFocusedNavigation()
|
|
160
168
|
if (navigation && hasOwn(global.__mpxPageStatusMap, navigation.pageId)) {
|
|
@@ -164,35 +172,55 @@ export default function createApp (options) {
|
|
|
164
172
|
})
|
|
165
173
|
|
|
166
174
|
let count = 0
|
|
167
|
-
let
|
|
175
|
+
let lastPageSize = getPageSize()
|
|
168
176
|
const resizeSubScription = ReactNative.Dimensions.addEventListener('change', ({ window }) => {
|
|
169
|
-
const
|
|
170
|
-
if (
|
|
171
|
-
|
|
177
|
+
const pageSize = getPageSize(window)
|
|
178
|
+
if (pageSize === lastPageSize) return
|
|
179
|
+
lastPageSize = pageSize
|
|
172
180
|
const navigation = getFocusedNavigation()
|
|
173
181
|
if (navigation && hasOwn(global.__mpxPageStatusMap, navigation.pageId)) {
|
|
174
182
|
global.__mpxPageStatusMap[navigation.pageId] = `resize${count++}`
|
|
175
183
|
}
|
|
176
184
|
})
|
|
177
185
|
return () => {
|
|
186
|
+
// todo 跳到原生页面或者其他rn bundle可以考虑使用reason 1/2进行模拟抹平
|
|
187
|
+
global.__mpxAppCbs.hide.forEach((cb) => {
|
|
188
|
+
cb({
|
|
189
|
+
reason: 0
|
|
190
|
+
})
|
|
191
|
+
})
|
|
178
192
|
changeSubscription && changeSubscription.remove()
|
|
179
193
|
resizeSubScription && resizeSubScription.remove()
|
|
180
194
|
}
|
|
181
195
|
}, [])
|
|
182
196
|
|
|
183
197
|
const { initialRouteName, initialParams } = initialRouteRef.current
|
|
184
|
-
const headerBackImageSource = Mpx.config.rnConfig.headerBackImageSource || null
|
|
185
198
|
const navScreenOpts = {
|
|
186
199
|
// 7.x替换headerBackTitleVisible
|
|
187
200
|
// headerBackButtonDisplayMode: 'minimal',
|
|
188
201
|
headerBackTitleVisible: false,
|
|
189
|
-
// 安卓上会出现初始化时闪现导航条的问题
|
|
190
|
-
headerShown: false,
|
|
191
|
-
// 隐藏导航下的那条线
|
|
192
202
|
headerShadowVisible: false
|
|
203
|
+
// 整体切换native-stack时进行修改如下
|
|
204
|
+
// statusBarTranslucent: true,
|
|
205
|
+
// statusBarBackgroundColor: 'transparent'
|
|
193
206
|
}
|
|
194
|
-
if (
|
|
195
|
-
|
|
207
|
+
if (__mpx_mode__ === 'ios') {
|
|
208
|
+
// ios使用native-stack
|
|
209
|
+
const headerBackImageSource = Mpx.config.rnConfig.headerBackImageSource || null
|
|
210
|
+
if (headerBackImageSource) {
|
|
211
|
+
navScreenOpts.headerBackImageSource = headerBackImageSource
|
|
212
|
+
}
|
|
213
|
+
} else {
|
|
214
|
+
// 安卓上会出现导航条闪现的问题所以默认加headerShown false(stack版本, native-stack版本可以干掉)
|
|
215
|
+
// iOS加上默认headerShown false的话会因为iOS根高度是screenHeight - useHeaderHeight()会导致出现渲染两次情况,因此iOS不加此默认值
|
|
216
|
+
navScreenOpts.headerShown = false
|
|
217
|
+
// 安卓和鸿蒙先用stack
|
|
218
|
+
const headerBackImageProps = Mpx.config.rnConfig.headerBackImageProps || null
|
|
219
|
+
if (headerBackImageProps) {
|
|
220
|
+
navScreenOpts.headerBackImage = () => {
|
|
221
|
+
return createElement(ReactNative.Image, headerBackImageProps)
|
|
222
|
+
}
|
|
223
|
+
}
|
|
196
224
|
}
|
|
197
225
|
|
|
198
226
|
return createElement(SafeAreaProvider,
|
|
@@ -126,5 +126,9 @@ export default function install (Vue) {
|
|
|
126
126
|
Vue.prototype.createIntersectionObserver = function (options) {
|
|
127
127
|
return createIntersectionObserver(this, options)
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
Vue.prototype.getPageId = function () {
|
|
131
|
+
return this.__pageId
|
|
132
|
+
}
|
|
129
133
|
hackEffectScope()
|
|
130
134
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useLayoutEffect, useSyncExternalStore, useRef, useMemo,
|
|
1
|
+
import { useEffect, useLayoutEffect, useSyncExternalStore, useRef, useMemo, createElement, memo, forwardRef, useImperativeHandle, useContext, Fragment, cloneElement, createContext } from 'react'
|
|
2
2
|
import * as ReactNative from 'react-native'
|
|
3
3
|
import { ReactiveEffect } from '../../observer/effect'
|
|
4
4
|
import { watch } from '../../observer/watch'
|
|
@@ -10,20 +10,19 @@ import mergeOptions from '../../core/mergeOptions'
|
|
|
10
10
|
import { queueJob, hasPendingJob } from '../../observer/scheduler'
|
|
11
11
|
import { createSelectorQuery, createIntersectionObserver } from '@mpxjs/api-proxy'
|
|
12
12
|
import { IntersectionObserverContext, RouteContext, KeyboardAvoidContext } from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/context'
|
|
13
|
-
import
|
|
13
|
+
import MpxKeyboardAvoidingView from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view'
|
|
14
14
|
|
|
15
15
|
const ProviderContext = createContext(null)
|
|
16
|
-
|
|
16
|
+
const windowDimensions = ReactNative.Dimensions.get('window')
|
|
17
|
+
const screenDimensions = ReactNative.Dimensions.get('screen')
|
|
17
18
|
function getSystemInfo () {
|
|
18
|
-
const window = ReactNative.Dimensions.get('window')
|
|
19
|
-
const screen = ReactNative.Dimensions.get('screen')
|
|
20
19
|
return {
|
|
21
|
-
deviceOrientation:
|
|
20
|
+
deviceOrientation: windowDimensions.width > windowDimensions.height ? 'landscape' : 'portrait',
|
|
22
21
|
size: {
|
|
23
|
-
screenWidth:
|
|
24
|
-
screenHeight:
|
|
25
|
-
windowWidth:
|
|
26
|
-
windowHeight:
|
|
22
|
+
screenWidth: screenDimensions.width,
|
|
23
|
+
screenHeight: screenDimensions.height,
|
|
24
|
+
windowWidth: windowDimensions.width,
|
|
25
|
+
windowHeight: windowDimensions.height
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
}
|
|
@@ -46,7 +45,9 @@ function createEffect (proxy, components) {
|
|
|
46
45
|
if (!tagName) return null
|
|
47
46
|
if (tagName === 'block') return Fragment
|
|
48
47
|
const appComponents = global.__getAppComponents?.() || {}
|
|
49
|
-
|
|
48
|
+
const generichash = proxy.target.generichash || ''
|
|
49
|
+
const genericComponents = global.__mpxGenericsMap[generichash] || noop
|
|
50
|
+
return components[tagName] || genericComponents(tagName) || appComponents[tagName] || getByPath(ReactNative, tagName)
|
|
50
51
|
}
|
|
51
52
|
const innerCreateElement = (type, ...rest) => {
|
|
52
53
|
if (!type) return null
|
|
@@ -286,11 +287,27 @@ function createInstance ({ propsRef, type, rawOptions, currentInject, validProps
|
|
|
286
287
|
instance.route = props.route.name
|
|
287
288
|
global.__mpxPagesMap = global.__mpxPagesMap || {}
|
|
288
289
|
global.__mpxPagesMap[props.route.key] = [instance, props.navigation]
|
|
290
|
+
// App onLaunch 在 Page created 之前执行
|
|
291
|
+
if (!global.__mpxAppHotLaunched && global.__mpxAppOnLaunch) {
|
|
292
|
+
global.__mpxAppOnLaunch(props.navigation)
|
|
293
|
+
}
|
|
289
294
|
}
|
|
290
295
|
|
|
291
296
|
const proxy = instance.__mpxProxy = new MpxProxy(rawOptions, instance)
|
|
292
297
|
proxy.created()
|
|
293
298
|
|
|
299
|
+
if (type === 'page') {
|
|
300
|
+
const loadParams = {}
|
|
301
|
+
const props = propsRef.current
|
|
302
|
+
// 此处拿到的props.route.params内属性的value被进行过了一次decode, 不符合预期,此处额外进行一次encode来与微信对齐
|
|
303
|
+
if (isObject(props.route.params)) {
|
|
304
|
+
for (const key in props.route.params) {
|
|
305
|
+
loadParams[key] = encodeURIComponent(props.route.params[key])
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
proxy.callHook(ONLOAD, [loadParams])
|
|
309
|
+
}
|
|
310
|
+
|
|
294
311
|
Object.assign(proxy, {
|
|
295
312
|
onStoreChange: null,
|
|
296
313
|
stateVersion: Symbol(),
|
|
@@ -384,7 +401,9 @@ const pageStatusMap = global.__mpxPageStatusMap = reactive({})
|
|
|
384
401
|
|
|
385
402
|
function usePageStatus (navigation, pageId) {
|
|
386
403
|
navigation.pageId = pageId
|
|
387
|
-
|
|
404
|
+
if (!hasOwn(pageStatusMap, pageId)) {
|
|
405
|
+
set(pageStatusMap, pageId, '')
|
|
406
|
+
}
|
|
388
407
|
useEffect(() => {
|
|
389
408
|
const focusSubscription = navigation.addListener('focus', () => {
|
|
390
409
|
pageStatusMap[pageId] = 'show'
|
|
@@ -422,17 +441,8 @@ const checkRelation = (options) => {
|
|
|
422
441
|
}
|
|
423
442
|
}
|
|
424
443
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
if (relation) {
|
|
428
|
-
return Object.assign({}, relation, { [componentPath]: instance })
|
|
429
|
-
} else {
|
|
430
|
-
return {
|
|
431
|
-
[componentPath]: instance
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
444
|
+
// 临时用来存储安卓底部(iOS没有这个)的高度(虚拟按键等高度)根据第一次进入推算
|
|
445
|
+
let bottomVirtualHeight = null
|
|
436
446
|
export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
|
|
437
447
|
rawOptions = mergeOptions(rawOptions, type, false)
|
|
438
448
|
const components = Object.assign({}, rawOptions.components, currentInject.getComponents())
|
|
@@ -502,19 +512,6 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
|
|
|
502
512
|
usePageEffect(proxy, pageId)
|
|
503
513
|
|
|
504
514
|
useEffect(() => {
|
|
505
|
-
if (type === 'page') {
|
|
506
|
-
if (!global.__mpxAppHotLaunched && global.__mpxAppOnLaunch) {
|
|
507
|
-
global.__mpxAppOnLaunch(props.navigation)
|
|
508
|
-
}
|
|
509
|
-
const loadParams = {}
|
|
510
|
-
// 此处拿到的props.route.params内属性的value被进行过了一次decode, 不符合预期,此处额外进行一次encode来与微信对齐
|
|
511
|
-
if (isObject(props.route.params)) {
|
|
512
|
-
for (const key in props.route.params) {
|
|
513
|
-
loadParams[key] = encodeURIComponent(props.route.params[key])
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
proxy.callHook(ONLOAD, [loadParams])
|
|
517
|
-
}
|
|
518
515
|
proxy.mounted()
|
|
519
516
|
return () => {
|
|
520
517
|
proxy.unmounted()
|
|
@@ -552,14 +549,28 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
|
|
|
552
549
|
root = createElement(ProviderContext.Provider, { value: provides }, root)
|
|
553
550
|
}
|
|
554
551
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
},
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
552
|
+
if (hasDescendantRelation) {
|
|
553
|
+
const relationProvide = useMemo(() => {
|
|
554
|
+
const componentPath = instance.__componentPath
|
|
555
|
+
if (relation) {
|
|
556
|
+
return Object.assign({}, relation, { [componentPath]: instance })
|
|
557
|
+
} else {
|
|
558
|
+
return {
|
|
559
|
+
[componentPath]: instance
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}, [relation])
|
|
563
|
+
|
|
564
|
+
return createElement(
|
|
565
|
+
RelationsContext.Provider,
|
|
566
|
+
{
|
|
567
|
+
value: relationProvide
|
|
568
|
+
},
|
|
569
|
+
root
|
|
570
|
+
)
|
|
571
|
+
} else {
|
|
572
|
+
return root
|
|
573
|
+
}
|
|
563
574
|
}))
|
|
564
575
|
|
|
565
576
|
if (rawOptions.options?.isCustomText) {
|
|
@@ -572,34 +583,70 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
|
|
|
572
583
|
const Page = ({ navigation, route }) => {
|
|
573
584
|
const currentPageId = useMemo(() => ++pageId, [])
|
|
574
585
|
const intersectionObservers = useRef({})
|
|
586
|
+
const routeContextValRef = useRef({
|
|
587
|
+
pageId: currentPageId,
|
|
588
|
+
navigation
|
|
589
|
+
})
|
|
575
590
|
usePageStatus(navigation, currentPageId)
|
|
576
591
|
useLayoutEffect(() => {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
headerShown: !isCustom,
|
|
580
|
-
title: pageConfig.navigationBarTitleText || '',
|
|
592
|
+
navigation.setOptions({
|
|
593
|
+
title: pageConfig.navigationBarTitleText?.trim() || '',
|
|
581
594
|
headerStyle: {
|
|
582
595
|
backgroundColor: pageConfig.navigationBarBackgroundColor || '#000000'
|
|
583
596
|
},
|
|
584
|
-
headerTintColor: pageConfig.navigationBarTextStyle || 'white'
|
|
585
|
-
statusBarTranslucent: true
|
|
586
|
-
}, __mpx_mode__ === 'android' ? { statusBarStyle: pageConfig.statusBarStyle || 'light' } : {}))
|
|
587
|
-
}, [])
|
|
588
|
-
|
|
589
|
-
const rootRef = useRef(null)
|
|
590
|
-
const keyboardAvoidRef = useRef({ cursorSpacing: 0, ref: null })
|
|
591
|
-
const onLayout = useCallback(() => {
|
|
592
|
-
rootRef.current?.measureInWindow((x, y, width, height) => {
|
|
593
|
-
navigation.layout = { x, y, width, height }
|
|
597
|
+
headerTintColor: pageConfig.navigationBarTextStyle || 'white'
|
|
594
598
|
})
|
|
599
|
+
|
|
600
|
+
// TODO 此部分内容在native-stack可删除,用setOptions设置
|
|
601
|
+
if (__mpx_mode__ === 'android' || __mpx_mode__ === 'harmony') {
|
|
602
|
+
ReactNative.StatusBar.setBarStyle(pageConfig.barStyle || 'dark-content')
|
|
603
|
+
ReactNative.StatusBar.setTranslucent(true) // 控制statusbar是否占位
|
|
604
|
+
ReactNative.StatusBar.setBackgroundColor('transparent')
|
|
605
|
+
}
|
|
595
606
|
}, [])
|
|
596
607
|
|
|
608
|
+
const rootRef = useRef(null)
|
|
609
|
+
const keyboardAvoidRef = useRef(null)
|
|
610
|
+
const headerHeight = useHeaderHeight()
|
|
611
|
+
const onLayout = () => {
|
|
612
|
+
if (__mpx_mode__ === 'ios') {
|
|
613
|
+
navigation.layout = {
|
|
614
|
+
x: 0,
|
|
615
|
+
y: headerHeight,
|
|
616
|
+
width: windowDimensions.width,
|
|
617
|
+
height: screenDimensions.height - headerHeight
|
|
618
|
+
}
|
|
619
|
+
} else {
|
|
620
|
+
if (bottomVirtualHeight === null) {
|
|
621
|
+
rootRef.current?.measureInWindow((height) => {
|
|
622
|
+
// 沉浸模式的计算方式
|
|
623
|
+
bottomVirtualHeight = screenDimensions.height - height - headerHeight
|
|
624
|
+
// 非沉浸模式(translucent=true)计算方式, 现在默认是全用沉浸模式,所以先不算这个
|
|
625
|
+
// bottomVirtualHeight = windowDimensions.height - height - headerHeight
|
|
626
|
+
navigation.layout = {
|
|
627
|
+
x: 0,
|
|
628
|
+
y: headerHeight,
|
|
629
|
+
width: windowDimensions.width,
|
|
630
|
+
height: height
|
|
631
|
+
}
|
|
632
|
+
})
|
|
633
|
+
} else {
|
|
634
|
+
navigation.layout = {
|
|
635
|
+
x: 0,
|
|
636
|
+
y: headerHeight, // 这个y值
|
|
637
|
+
width: windowDimensions.width,
|
|
638
|
+
// 后续页面的layout是通过第一次路由进入时候推算出来的底部区域来推算出来的
|
|
639
|
+
height: screenDimensions.height - bottomVirtualHeight - headerHeight
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
597
644
|
const withKeyboardAvoidingView = (element) => {
|
|
598
645
|
return createElement(KeyboardAvoidContext.Provider,
|
|
599
646
|
{
|
|
600
647
|
value: keyboardAvoidRef
|
|
601
648
|
},
|
|
602
|
-
createElement(
|
|
649
|
+
createElement(MpxKeyboardAvoidingView,
|
|
603
650
|
{
|
|
604
651
|
style: {
|
|
605
652
|
flex: 1
|
|
@@ -619,12 +666,12 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
|
|
|
619
666
|
{
|
|
620
667
|
// https://github.com/software-mansion/react-native-reanimated/issues/6639 因存在此问题,iOS在页面上进行定宽来暂时规避
|
|
621
668
|
style: __mpx_mode__ === 'ios' && pageConfig.navigationStyle !== 'custom'
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
669
|
+
? {
|
|
670
|
+
height: ReactNative.Dimensions.get('screen').height - useHeaderHeight()
|
|
671
|
+
}
|
|
672
|
+
: {
|
|
673
|
+
flex: 1
|
|
674
|
+
}
|
|
628
675
|
},
|
|
629
676
|
withKeyboardAvoidingView(
|
|
630
677
|
createElement(ReactNative.View,
|
|
@@ -634,14 +681,12 @@ export function getDefaultOptions ({ type, rawOptions = {}, currentInject }) {
|
|
|
634
681
|
backgroundColor: pageConfig.backgroundColor || '#ffffff'
|
|
635
682
|
},
|
|
636
683
|
ref: rootRef,
|
|
684
|
+
// 测试过了 键盘拉起后不会重新触发onLayout
|
|
637
685
|
onLayout
|
|
638
686
|
},
|
|
639
687
|
createElement(RouteContext.Provider,
|
|
640
688
|
{
|
|
641
|
-
value:
|
|
642
|
-
pageId: currentPageId,
|
|
643
|
-
navigation
|
|
644
|
-
}
|
|
689
|
+
value: routeContextValRef.current
|
|
645
690
|
},
|
|
646
691
|
createElement(IntersectionObserverContext.Provider,
|
|
647
692
|
{
|
|
@@ -60,7 +60,8 @@ export function getDefaultOptions ({ type, rawOptions = {} }) {
|
|
|
60
60
|
selectComponent: instance.selectComponent.bind(instance),
|
|
61
61
|
selectAllComponents: instance.selectAllComponents.bind(instance),
|
|
62
62
|
createSelectorQuery: instance.createSelectorQuery.bind(instance),
|
|
63
|
-
createIntersectionObserver: instance.createIntersectionObserver.bind(instance)
|
|
63
|
+
createIntersectionObserver: instance.createIntersectionObserver.bind(instance),
|
|
64
|
+
getPageId: instance.getPageId.bind(instance)
|
|
64
65
|
}
|
|
65
66
|
const setupRes = rawSetup(props, newContext)
|
|
66
67
|
unsetCurrentInstance(instance.__mpxProxy)
|
|
File without changes
|
package/LICENSE
DELETED
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
|
|
5
|
-
http://www.apache.org/licenses/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
1. Definitions.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
21
|
-
|
|
22
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
28
|
-
|
|
29
|
-
the copyright owner that is granting the License.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
35
|
-
|
|
36
|
-
other entities that control, are controlled by, or are under common
|
|
37
|
-
|
|
38
|
-
control with that entity. For the purposes of this definition,
|
|
39
|
-
|
|
40
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
41
|
-
|
|
42
|
-
direction or management of such entity, whether by contract or
|
|
43
|
-
|
|
44
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
45
|
-
|
|
46
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
52
|
-
|
|
53
|
-
exercising permissions granted by this License.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
59
|
-
|
|
60
|
-
including but not limited to software source code, documentation
|
|
61
|
-
|
|
62
|
-
source, and configuration files.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"Object" form shall mean any form resulting from mechanical
|
|
68
|
-
|
|
69
|
-
transformation or translation of a Source form, including but
|
|
70
|
-
|
|
71
|
-
not limited to compiled object code, generated documentation,
|
|
72
|
-
|
|
73
|
-
and conversions to other media types.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
79
|
-
|
|
80
|
-
Object form, made available under the License, as indicated by a
|
|
81
|
-
|
|
82
|
-
copyright notice that is included in or attached to the work
|
|
83
|
-
|
|
84
|
-
(an example is provided in the Appendix below).
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
90
|
-
|
|
91
|
-
form, that is based on (or derived from) the Work and for which the
|
|
92
|
-
|
|
93
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
94
|
-
|
|
95
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
96
|
-
|
|
97
|
-
of this License, Derivative Works shall not include works that remain
|
|
98
|
-
|
|
99
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
100
|
-
|
|
101
|
-
the Work and Derivative Works thereof.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"Contribution" shall mean any work of authorship, including
|
|
107
|
-
|
|
108
|
-
the original version of the Work and any modifications or additions
|
|
109
|
-
|
|
110
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
111
|
-
|
|
112
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
113
|
-
|
|
114
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
115
|
-
|
|
116
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
117
|
-
|
|
118
|
-
means any form of electronic, verbal, or written communication sent
|
|
119
|
-
|
|
120
|
-
to the Licensor or its representatives, including but not limited to
|
|
121
|
-
|
|
122
|
-
communication on electronic mailing lists, source code control systems,
|
|
123
|
-
|
|
124
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
125
|
-
|
|
126
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
127
|
-
|
|
128
|
-
excluding communication that is conspicuously marked or otherwise
|
|
129
|
-
|
|
130
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
136
|
-
|
|
137
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
138
|
-
|
|
139
|
-
subsequently incorporated within the Work.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
145
|
-
|
|
146
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
147
|
-
|
|
148
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
149
|
-
|
|
150
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
151
|
-
|
|
152
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
153
|
-
|
|
154
|
-
Work and such Derivative Works in Source or Object form.
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
160
|
-
|
|
161
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
162
|
-
|
|
163
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
164
|
-
|
|
165
|
-
(except as stated in this section) patent license to make, have made,
|
|
166
|
-
|
|
167
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
168
|
-
|
|
169
|
-
where such license applies only to those patent claims licensable
|
|
170
|
-
|
|
171
|
-
by such Contributor that are necessarily infringed by their
|
|
172
|
-
|
|
173
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
174
|
-
|
|
175
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
176
|
-
|
|
177
|
-
institute patent litigation against any entity (including a
|
|
178
|
-
|
|
179
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
180
|
-
|
|
181
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
182
|
-
|
|
183
|
-
or contributory patent infringement, then any patent licenses
|
|
184
|
-
|
|
185
|
-
granted to You under this License for that Work shall terminate
|
|
186
|
-
|
|
187
|
-
as of the date such litigation is filed.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
193
|
-
|
|
194
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
195
|
-
|
|
196
|
-
modifications, and in Source or Object form, provided that You
|
|
197
|
-
|
|
198
|
-
meet the following conditions:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
(a) You must give any other recipients of the Work or
|
|
204
|
-
|
|
205
|
-
Derivative Works a copy of this License; and
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
(b) You must cause any modified files to carry prominent notices
|
|
211
|
-
|
|
212
|
-
stating that You changed the files; and
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
218
|
-
|
|
219
|
-
that You distribute, all copyright, patent, trademark, and
|
|
220
|
-
|
|
221
|
-
attribution notices from the Source form of the Work,
|
|
222
|
-
|
|
223
|
-
excluding those notices that do not pertain to any part of
|
|
224
|
-
|
|
225
|
-
the Derivative Works; and
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
231
|
-
|
|
232
|
-
distribution, then any Derivative Works that You distribute must
|
|
233
|
-
|
|
234
|
-
include a readable copy of the attribution notices contained
|
|
235
|
-
|
|
236
|
-
within such NOTICE file, excluding those notices that do not
|
|
237
|
-
|
|
238
|
-
pertain to any part of the Derivative Works, in at least one
|
|
239
|
-
|
|
240
|
-
of the following places: within a NOTICE text file distributed
|
|
241
|
-
|
|
242
|
-
as part of the Derivative Works; within the Source form or
|
|
243
|
-
|
|
244
|
-
documentation, if provided along with the Derivative Works; or,
|
|
245
|
-
|
|
246
|
-
within a display generated by the Derivative Works, if and
|
|
247
|
-
|
|
248
|
-
wherever such third-party notices normally appear. The contents
|
|
249
|
-
|
|
250
|
-
of the NOTICE file are for informational purposes only and
|
|
251
|
-
|
|
252
|
-
do not modify the License. You may add Your own attribution
|
|
253
|
-
|
|
254
|
-
notices within Derivative Works that You distribute, alongside
|
|
255
|
-
|
|
256
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
257
|
-
|
|
258
|
-
that such additional attribution notices cannot be construed
|
|
259
|
-
|
|
260
|
-
as modifying the License.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
You may add Your own copyright statement to Your modifications and
|
|
266
|
-
|
|
267
|
-
may provide additional or different license terms and conditions
|
|
268
|
-
|
|
269
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
270
|
-
|
|
271
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
272
|
-
|
|
273
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
274
|
-
|
|
275
|
-
the conditions stated in this License.
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
281
|
-
|
|
282
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
283
|
-
|
|
284
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
285
|
-
|
|
286
|
-
this License, without any additional terms or conditions.
|
|
287
|
-
|
|
288
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
289
|
-
|
|
290
|
-
the terms of any separate license agreement you may have executed
|
|
291
|
-
|
|
292
|
-
with Licensor regarding such Contributions.
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
298
|
-
|
|
299
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
300
|
-
|
|
301
|
-
except as required for reasonable and customary use in describing the
|
|
302
|
-
|
|
303
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
309
|
-
|
|
310
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
311
|
-
|
|
312
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
313
|
-
|
|
314
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
315
|
-
|
|
316
|
-
implied, including, without limitation, any warranties or conditions
|
|
317
|
-
|
|
318
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
319
|
-
|
|
320
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
321
|
-
|
|
322
|
-
appropriateness of using or redistributing the Work and assume any
|
|
323
|
-
|
|
324
|
-
risks associated with Your exercise of permissions under this License.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
330
|
-
|
|
331
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
332
|
-
|
|
333
|
-
unless required by applicable law (such as deliberate and grossly
|
|
334
|
-
|
|
335
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
336
|
-
|
|
337
|
-
liable to You for damages, including any direct, indirect, special,
|
|
338
|
-
|
|
339
|
-
incidental, or consequential damages of any character arising as a
|
|
340
|
-
|
|
341
|
-
result of this License or out of the use or inability to use the
|
|
342
|
-
|
|
343
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
344
|
-
|
|
345
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
346
|
-
|
|
347
|
-
other commercial damages or losses), even if such Contributor
|
|
348
|
-
|
|
349
|
-
has been advised of the possibility of such damages.
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
355
|
-
|
|
356
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
357
|
-
|
|
358
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
359
|
-
|
|
360
|
-
or other liability obligations and/or rights consistent with this
|
|
361
|
-
|
|
362
|
-
License. However, in accepting such obligations, You may act only
|
|
363
|
-
|
|
364
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
365
|
-
|
|
366
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
367
|
-
|
|
368
|
-
defend, and hold each Contributor harmless for any liability
|
|
369
|
-
|
|
370
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
371
|
-
|
|
372
|
-
of your accepting any such warranty or additional liability.
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
END OF TERMS AND CONDITIONS
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
To apply the Apache License to your work, attach the following
|
|
388
|
-
|
|
389
|
-
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
390
|
-
|
|
391
|
-
replaced with your own identifying information. (Don't include
|
|
392
|
-
|
|
393
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
394
|
-
|
|
395
|
-
comment syntax for the file format. We also recommend that a
|
|
396
|
-
|
|
397
|
-
file or class name and description of purpose be included on the
|
|
398
|
-
|
|
399
|
-
same "printed page" as the copyright notice for easier
|
|
400
|
-
|
|
401
|
-
identification within third-party archives.
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd. All rights reserved.
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
412
|
-
|
|
413
|
-
you may not use this file except in compliance with the License.
|
|
414
|
-
|
|
415
|
-
You may obtain a copy of the License at
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
Unless required by applicable law or agreed to in writing, software
|
|
426
|
-
|
|
427
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
428
|
-
|
|
429
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
430
|
-
|
|
431
|
-
See the License for the specific language governing permissions and
|
|
432
|
-
|
|
433
|
-
limitations under the License.
|