Skip to content

ScrollView contentOffset bug #15808

Closed
Closed
@vivalaakam

Description

@vivalaakam

Hi! in RN 0.48.1 doesn`t work contentOffset when component is initialized.
Here is example for reproduction https://github.com/vivalaakam/rn_issue

In this example after initialize i will be see second screen, named 'Welcome to screen #2'

In version 0.47.2 it work as well

  1. react-native -v
react-native-cli: 2.0.1
react-native: 0.48.1
  1. node -v
v8.4.0
  1. npm -v
5.4.0
  1. yarn --version
0.27.5

Activity

stage88

stage88 commented on Sep 5, 2017

@stage88

This is probably related to 1d22f8f, the scenario the commit addresses doesn't apply to me so i have replaced line 319 in node_modules/react-native/React/Views/RCTScrollView.m with

// self.contentOffset = CGPointMake(
//   MAX(0, MIN(originalOffset.x, fullContentSize.width - boundsSize.width)),
//   MAX(0, MIN(originalOffset.y, fullContentSize.height - boundsSize.height)));
self.contentOffset= originalOffset;

That fixes my negative offset with refresh control problem, it will have to do until the issue is fixed.

shergin

shergin commented on Sep 5, 2017

@shergin
Contributor

Well, the problem with this issue is that contentOffset prop should not exist in the first place. (And it does not exist on Android.)
Could we use scrollTo method instead?

janicduplessis

janicduplessis commented on Sep 5, 2017

@janicduplessis
Contributor

@shergin I think we should try landing #15670 to fix that regression

krizpoon

krizpoon commented on Sep 15, 2017

@krizpoon

I have similar problem and solved it with:

self.contentOffset = CGPointMake(
    MAX(-contentInset.left, MIN(originalOffset.x, fullContentSize.width - boundsSize.width)),
    MAX(-contentInset.top, MIN(originalOffset.y, fullContentSize.height - boundsSize.height)));
pull-bot

pull-bot commented on Oct 10, 2017

@pull-bot
facebook-github-bot

facebook-github-bot commented on Oct 10, 2017

@facebook-github-bot
Contributor

Hey, thanks for reporting this issue! It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the Issue Template? This is necessary for people to be able to understand and reproduce the issue being reported. I am going to close this, but feel free to open a new issue with the additional information provided. Thanks! See "What to Expect from Maintainers" to learn more.

henrikra

henrikra commented on Oct 27, 2017

@henrikra

@shergin Could you explain more why contentOffset prop should not exists? For example now on Android I have to do weird hacks to init scroll view's position to something that I want.

6 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @shergin@vivalaakam@krizpoon@janicduplessis@facebook-github-bot

        Issue actions

          ScrollView contentOffset bug · Issue #15808 · facebook/react-native