diff --git a/driver/js/examples/hippy-react-demo/src/components/ListView/index.jsx b/driver/js/examples/hippy-react-demo/src/components/ListView/index.jsx index eb57411f47b..6c50de00f2e 100644 --- a/driver/js/examples/hippy-react-demo/src/components/ListView/index.jsx +++ b/driver/js/examples/hippy-react-demo/src/components/ListView/index.jsx @@ -4,7 +4,6 @@ import { View, StyleSheet, Text, - Platform, } from '@hippy/react'; const STYLE_LOADING = 100; @@ -271,8 +270,7 @@ export default class ListExample extends React.Component { return true; }} bounces={true} - // horizontal ListView flag(only Android support) - horizontal={horizontal} + horizontal={horizontal} // horizontal ListView flag style={[{ backgroundColor: '#ffffff' }, horizontal ? { height: 50 } : { flex: 1 }]} numberOfRows={dataSource.length} renderRow={this.getRenderRow} @@ -297,33 +295,32 @@ export default class ListExample extends React.Component { onScroll={this.onScroll} scrollEventThrottle={1000} // 1s /> - {Platform.OS === 'android' - ? this.changeDirection()} - style={{ - position: 'absolute', - right: 20, - bottom: 20, - width: 67, - height: 67, - borderRadius: 30, - boxShadowOpacity: 0.6, - boxShadowRadius: 5, - boxShadowOffsetX: 3, - boxShadowOffsetY: 3, - boxShadowColor: '#4c9afa' }}> - + this.changeDirection()} + style={{ + position: 'absolute', + right: 20, + bottom: 20, + width: 67, + height: 67, + borderRadius: 30, + boxShadowOpacity: 0.6, + boxShadowRadius: 5, + boxShadowOffsetX: 3, + boxShadowOffsetY: 3, + boxShadowColor: '#4c9afa' }}> + 切换方向 - : null} + ); } diff --git a/driver/js/examples/hippy-vue-demo/src/components/demos/demo-list.vue b/driver/js/examples/hippy-vue-demo/src/components/demos/demo-list.vue index 853bda36ee8..24d2a913cb2 100644 --- a/driver/js/examples/hippy-vue-demo/src/components/demos/demo-list.vue +++ b/driver/js/examples/hippy-vue-demo/src/components/demos/demo-list.vue @@ -78,7 +78,6 @@
-import { type ListViewEvent, Native } from '@hippy/vue-next'; +import { type ListViewEvent } from '@hippy/vue-next'; import { defineComponent, ref, onMounted, type Ref } from '@vue/runtime-core'; const STYLE_LOADING = 100; @@ -269,7 +268,6 @@ export default defineComponent({ list, STYLE_LOADING, horizontal, - Platform: Native.Platform, onAppear, onDelete, onDisappear, diff --git a/framework/ios/base/bridge/HippyBridge.mm b/framework/ios/base/bridge/HippyBridge.mm index 1de3a8eecb1..4f644c7c684 100644 --- a/framework/ios/base/bridge/HippyBridge.mm +++ b/framework/ios/base/bridge/HippyBridge.mm @@ -183,7 +183,7 @@ @interface HippyBridge() { /// Bundle fetch operation queue (concurrent) @property (nonatomic, strong) NSOperationQueue *bundleQueue; /// Record the last execute operation for adding execution dependency. -@property (atomic, strong, nullable) NSOperation *lastExecuteOperation; +@property (nonatomic, strong, nullable) NSOperation *lastExecuteOperation; /// Cached Dimensions info,will be passed to JS Side. @property (atomic, strong) NSDictionary *cachedDimensionsInfo; @@ -591,13 +591,17 @@ - (void)beginLoadingBundle:(NSURL *)bundleURL strongSelf.valid, script]; HippyLogError(@"%@", errMsg); completion(bundleURL, HippyErrorWithMessage(errMsg)); - strongSelf.lastExecuteOperation = nil; + @synchronized (self) { + strongSelf.lastExecuteOperation = nil; + } return; } [strongSelf executeJSCode:script sourceURL:bundleURL onCompletion:^(id result, NSError *error) { HippyLogInfo(@"End executing bundle(%s)", HP_CSTR_NOT_NULL(bundleURL.absoluteString.lastPathComponent.UTF8String)); - strongSelf.lastExecuteOperation = nil; + @synchronized (self) { + strongSelf.lastExecuteOperation = nil; + } if (completion) { completion(bundleURL, error); } @@ -624,13 +628,18 @@ - (void)beginLoadingBundle:(NSURL *)bundleURL // Add dependency, make sure that doing fetch before execute, // and all execution operations must be queued. [executeOperation addDependency:fetchOperation]; - if (self.lastExecuteOperation) { - [executeOperation addDependency:self.lastExecuteOperation]; + @synchronized (self) { + NSOperation *lastOp = self.lastExecuteOperation; + if (lastOp) { + [executeOperation addDependency:lastOp]; + } } // Enqueue operation [_bundleQueue addOperations:@[fetchOperation, executeOperation] waitUntilFinished:NO]; - self.lastExecuteOperation = executeOperation; + @synchronized (self) { + self.lastExecuteOperation = executeOperation; + } } - (void)unloadInstanceForRootView:(NSNumber *)rootTag { diff --git a/modules/footstone/include/footstone/logging.h b/modules/footstone/include/footstone/logging.h index 71f5dbd2ee9..3cfa7329c76 100644 --- a/modules/footstone/include/footstone/logging.h +++ b/modules/footstone/include/footstone/logging.h @@ -225,9 +225,9 @@ bool ShouldCreateLogMessage(LogSeverity severity); #define HP_CSTR_NOT_NULL( p ) (p ? p : "") -#ifdef DEBUG +#ifdef ENABLE_HIPPY_PERFLOG +// enable perf log output when `ENABLE_HIPPY_PERFLOG` is set -// enable perf log output in debug mode only #define TDF_PERF_LOG(format, ...) \ footstone::LogMessage::LogWithFormat(__FILE_NAME__, __LINE__, "[HP PERF] " format, \ ##__VA_ARGS__) @@ -241,4 +241,4 @@ footstone::LogMessage::LogWithFormat(__FILE_NAME__, __LINE__, "[HP PERF] " forma #define TDF_PERF_LOG(format, ...) #define TDF_PERF_DO_STMT_AND_LOG(STMT , format, ...) -#endif +#endif /* ENABLE_HIPPY_PERFLOG */