Skip to content

删除多余log,解决持续上划回弹bug #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified harmony/smart_refresh_layout.har
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ class SmartRefreshLayoutEmitRequestHandler : public EventEmitRequestHandler {
float offset = (float)arkJs.getDouble(arkJs.getObjectProperty(ctx.payload, "offset"));
float headerHeight = (float)arkJs.getDouble(arkJs.getObjectProperty(ctx.payload, "headerHeight"));
facebook::react::SmartRefreshLayoutEventEmitter::OnHeaderPulling event{percent, offset, headerHeight};
LOG(INFO) << "onHeaderPulling " << event.headerHeight << event.offset << event.percent;
eventEmitter->onHeaderPulling(event);
} else if (eventName == "onHeaderReleasing") {
float percent = (float)arkJs.getDouble(arkJs.getObjectProperty(ctx.payload, "percent"));
float offset = (float)arkJs.getDouble(arkJs.getObjectProperty(ctx.payload, "offset"));
float headerHeight = (float)arkJs.getDouble(arkJs.getObjectProperty(ctx.payload, "headerHeight"));
facebook::react::SmartRefreshLayoutEventEmitter::OnHeaderReleasing event{percent, offset, headerHeight};
LOG(INFO) << "onHeaderReleasing " << event.headerHeight << event.offset << event.percent;
eventEmitter->onHeaderReleasing(event);
}
}
Expand Down
2 changes: 1 addition & 1 deletion harmony/smart_refresh_layout/src/main/ets/Logger.ets
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ class Logger {
}
}

export default new Logger('RNCProgressBar', 0xFF00, false)
export default new Logger('SmartRefreshLayout', 0xFF00, false)
31 changes: 17 additions & 14 deletions harmony/smart_refresh_layout/src/main/ets/PullToRefresh.ets
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// 对比原库新增finishDelay getScroller
/* 对比原库新增finishDelay getScroller
* 修改可下拉区域为50%(371行,375行)
* 屏蔽scrollEdge(356行)
*/
import { PullToRefreshConfigurator } from './PullToRefreshConfigurator'

const IS_FREE = 0;
Expand Down Expand Up @@ -350,26 +353,26 @@ export struct PullToRefresh {
if (this.refreshConfigurator !== undefined) {
let maxTranslate = this.refreshConfigurator.getMaxTranslate()
let refreshAnimDuration = this.refreshConfigurator.getRefreshAnimDuration();
if (this.refreshConfigurator.getListIsPlacement()) {
if (this.state !== undefined) {
if (this.state == IS_PULL_DOWN_1 || this.state == IS_PULL_DOWN_2) {
// 让列表归位到顶部
this.getScroller().scrollEdge(Edge.Top);
// 让列表归位到底部
} else if (this.state == IS_PULL_UP_1 || this.state == IS_PULL_UP_2) {
this.getScroller().scrollEdge(Edge.Bottom);
}
}
}
// if (this.refreshConfigurator.getListIsPlacement()) {
// if (this.state !== undefined) {
// if (this.state == IS_PULL_DOWN_1 || this.state == IS_PULL_DOWN_2) {
// // 让列表归位到顶部
// this.getScroller().scrollEdge(Edge.Top);
// // 让列表归位到底部
// } else if (this.state == IS_PULL_UP_1 || this.state == IS_PULL_UP_2) {
// this.getScroller().scrollEdge(Edge.Bottom);
// }
// }
// }
if (this.trYTop !== undefined) {
if (this.trYTop > 0) { // 下拉结束
if (this.state !== undefined && maxTranslate !== undefined) {
if (this.state == IS_FREE || this.state == IS_PULL_DOWN_1 || this.state == IS_PULL_DOWN_2) {
if (this.trYTop / maxTranslate < 0.75) {
if (this.trYTop / maxTranslate < 0.5) {
this.closeRefresh();
} else {
this.state = IS_REFRESHING;
this.trYTop = maxTranslate * 0.75;
this.trYTop = maxTranslate * 0.5;
clearInterval(this.timer);
this.timer = setInterval(() => {
if (this.value !== undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export struct SmartRefreshControl {
RNComponentFactory({ ctx: this.ctx, tag: this.data[1], buildCustomComponent: this.buildCustomComponent })
}
.onAreaChange((oldValue: Area, newValue: Area) => {
Logger.info(TAG,"RNOH SmartRefreshControl:onAreaChange " + JSON.stringify(newValue.height))
Logger.debug(TAG,"RNOH SmartRefreshControl:onAreaChange " + JSON.stringify(newValue.height))
this.checkHeaderMove(parseInt(newValue.height.toString()))
})
.width('100%')
Expand Down Expand Up @@ -169,8 +169,11 @@ export struct SmartRefreshControl {
}

checkHeaderMove(displayedHeaderHeight:number){
if (this.unlockScrollingCallback === undefined && displayedHeaderHeight != 0){
// 滚动时保持吸顶
if (this.getScroller().currentOffset().yOffset !== 0){
this.getScroller().scrollEdge(Edge.Top)
}
if (this.unlockScrollingCallback === undefined && displayedHeaderHeight != 0){
this.unlockScrollingCallback = this.getChildScrollViewComponentManager()?.lockScrolling()
}
if (this.unlockScrollingCallback !== undefined && displayedHeaderHeight == 0){
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@react-native-oh-tpl/react-native-smartrefreshlayout",
"version": "0.6.7-0.0.9",
"version": "0.6.7-0.1.0",
"description": "基于android SmartRefreshLayout的封装",
"main": "lib/commonjs/index.js",
"react-native": "src/index.tsx",
Expand Down