已合并
feat(ScrollView): add HarmonyOS-specific flingSpeedLimit property #2480
luqi创建于 3月26日
feat(ScrollView): add HarmonyOS-specific flingSpeedLimit property #2480
已合并
luqi创建于 3月26日
从已删除 :master合入到CPF-RN/ohos_react_nativemaster
共 7 个文件变更+193-1
Mreact-native-harmony/Libraries/Components/ScrollView/ScrollView.harmony.js+7-0文件内容审核中,请稍后刷新重试
Mreact-native-harmony/types/index.d.ts+12-0文件内容审核中,请稍后刷新重试
@@ -227,6 +227,13 @@ void rnoh::ScrollViewComponentInstance::onPropsChanged(
227 }227 }
228 }228 }
229 229 
230+ if (m_rawProps.flingSpeedLimit != rawProps.flingSpeedLimit) {
G
Ggyange3月26日

这个属性应该在初始时设置异常,后面应该都不再变化,不建议加在该流程每次判断,放在Scroll组件初始化的部分

likedislike
luqi
luqi
3月26日 评论:
231+ m_rawProps.flingSpeedLimit = rawProps.flingSpeedLimit;
232+ if (m_rawProps.flingSpeedLimit.has_value()) {
233+ m_scrollNode.setFlingSpeedLimit(m_rawProps.flingSpeedLimit.value());
234+ }
235+ }
236+ 
230 if (!m_props || props->contentOffset != m_props->contentOffset ||237 if (!m_props || props->contentOffset != m_props->contentOffset ||
231 props->scrollToOverflowEnabled != m_props->scrollToOverflowEnabled) {238 props->scrollToOverflowEnabled != m_props->scrollToOverflowEnabled) {
232 m_scrollNode.scrollTo(239 m_scrollNode.scrollTo(
@@ -850,8 +857,11 @@ ScrollViewComponentInstance::ScrollViewRawProps::getFromDynamic(folly::dynamic v
850 auto fadingEdgeLength = (value.count("fadingEdgeLength") > 0)857 auto fadingEdgeLength = (value.count("fadingEdgeLength") > 0)
851 ? std::optional(value["fadingEdgeLength"].asDouble())858 ? std::optional(value["fadingEdgeLength"].asDouble())
852 : std::nullopt;859 : std::nullopt;
860+ auto flingSpeedLimit = (value.count("flingSpeedLimit") > 0)
861+ ? std::optional<float>(value["flingSpeedLimit"].asDouble())
862+ : std::nullopt;
853 863
854- return {overScrollMode, nestedEnabled, endFillColor, fadingEdgeLength};864+ return {overScrollMode, nestedEnabled, endFillColor, fadingEdgeLength, flingSpeedLimit};
855}865}
856 866 
857facebook::react::Point ScrollViewComponentInstance::getContentViewOffset()867facebook::react::Point ScrollViewComponentInstance::getContentViewOffset()
Atester/tests/ScrollViewTest/FlingSpeedLimitTest.tsx+159-0文件内容审核中,请稍后刷新重试
Mtester/tests/ScrollViewTest/ScrollViewTest.tsx+2-0文件内容审核中,请稍后刷新重试