Skip to content
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

[iOS] New dynamic page can't be scrolled to unless scrolled back #791

Closed
kbkmn opened this issue Nov 14, 2023 · 2 comments
Closed

[iOS] New dynamic page can't be scrolled to unless scrolled back #791

kbkmn opened this issue Nov 14, 2023 · 2 comments
Assignees

Comments

@kbkmn
Copy link

kbkmn commented Nov 14, 2023

ios
react-native 0.72.6
react-native-pager-view 6.2.2

Screen.Recording.2023-11-14.at.19.44.08.mp4

The most basic setup:

const TabView = () => {
  const ref = useRef<PagerView>(null);
  const [pages, setPages] = useState<number[]>([0]);

  const renderPages = useMemo(
    () =>
      pages.map(page => (
        <View key={page} style={{flexGrow: 1, padding: 8}}>
          <Text style={{fontSize: 30}}>#{page}</Text>
        </View>
      )),
    [pages],
  );

  return (
    <>
      <View style={{flexDirection: 'row', justifyContent: 'space-between'}}>
        <Button
          title="Add"
          onPress={() => {
            setPages(current => [...current, current.length]);
          }}
        />
      </View>

      <PagerView ref={ref} initialPage={0} style={{flexGrow: 1}}>
        {renderPages}
      </PagerView>
    </>
  );
};
@michalkvasnicak
Copy link

We have same issue on vertical orientation.

@MrRefactor
Copy link
Collaborator

Fixed in #898

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants