Scrollview contentcontainerstyle. This time View moved to the center of the screen. Scrollview contentcontainerstyle

 
This time View moved to the center of the screenScrollview contentcontainerstyle  Q&A for work

You would have to calculate the width of the device or container. First, I made my statusBar animated: const AnimatedStatusBar = Animated. Don't be scared of React-Native upgrades anymore!1 Answer. current is reference of scrollview, and index -1, 200 is actually unnecessary here. If you want to give styling to ScrollView then you should use contentContainerStyle. The problem I run into now is as follows: If I give the scrollview contentcontainerstyle flexGrow: 1, then the scrolling works as normal, but I cannot give the children sections of the scrollview space dimensions with flex values. get ('window. Currently, the scrollView won't expand to contain everything despite trying what is seemingly every bit of advice online. Over 200k developers use LogRocket to create better digital experiences. Here's the problem: I scroll the WebView without a problem, but whenever I swipe up to go to the top of the page, doesn't matter if I'm on the end, the middle or the beginning of the page, the refreshControl is always triggered. Photo by Shahadat Rahman on Unsplash. 1. 33. To solve this problem we need to use contentContainerStyle prop with flexGrow and justifyContent. answered May 26, 2019 at 8:31. However, when it is first shown, the accordion lists are all collapsed. ScrollView (Showing top 2 results out of 315) styled-components ( npm) StyledInterface ScrollView. It can contain a single child or multiple children elements and is often used for scrolling a small amount of content. This works perfectly for me on Android and iOS and does not clip the content on the scroll (iOS) if the content. I have switched off scroll on the body to isolate the scroll view to no effect. A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objectsHere is a possible solution. Improve this answer. width; Glad to help. That makes it very easy to understand and use. Remove the ScrollView from Layout or remove the KeyboardAwareScrollView. Scroll View not scrolling in react native. 👉 This component is used in my production app Game ideas. You can use it like this: import {Dimensions} from 'react-native'+ // Then, in your component: render () { const {width, height} = Dimensions. Beginners often waste a lot of time figuring out how to properly style the ScrollView because it has two styling props: style and contentContainerStyle. So you don't need to calculate it manually. Follow edited Sep 22, 2019 at 9:50. scrollContainer}>{items}</ScrollView> Your scrollContainer style will look like this: scrollContainer: {paddingHorizontal: 2, paddingVertical: 2,} Try using the ScrollContainer without passing a content style. create({ contentContainer: { paddingVertical: 20} }); I am using scrollview in my react native project. contentContainerStyle is a step in the right direction. 1. If type == 1 return below component. Thank you. current isn't specific to scrollView. I'm looking to expand the nested component so its height is 100% of the content within it. it stores reference to . Teams. This prop takes an. It seems to cover all the objects I created (not programmatically) on the ConstraintLayout at the back. It can automatically adjust either its height, position, or bottom padding based on the keyboard height. I was stuck with this issue. And also the child ScrollViews has flex: 1. One important note is that we must use the explicit composite rendering architecture because we want access to the DOM object from the controlling component to easily extract headings, which is more tedious when using the implicit. g items alignments, padding, etc ScrollView takes a contentContainerStyle prop vs the normal style prop that will describe the styling. when press one off the marker i want to the scrollview set to the position of my makerThe @azcarraga's solution with adding contentContainerStyle={{ flexGrow: 1 }} to <ScrollView /> seems to work. Imagine you have a very long list of items you want to display, maybe several screens worth of content. I can't figure out how to get this to happen. scrollView. I am trying to center the images based on the device height with equivalent padding on both top and bottom. Rahul Mishra Rahul Mishra. Here’s a short explanation of those props: The style prop is used for the styling of the ScrollView parent element, which we can think of as a simple, non-scrollable View. contentContainerStyle, etc. By reference, I have created a component that will do the work for you, as you can take a look or simple copy and use. Mar 4, 2021 at 6:36. Notice the added style contentContainerStyle={{ backgroundColor: 'brown' }}. Teams. -1. This fixes the vertical centering on page 1, but I'm no longer able to scroll all the way down to the bottom on page 2. ScrollView in React Native. Q&A for work. By default, the Sentry SDK initialization adds a unique Data Source Name (DSN) string that. Im strungling to figure out what is wrong with flex and scrolllview ! I Change the flex value to 2 in headerView and still nothing ,its just does not wanna show up ,then i try to change to the cardsView and still nothing!Component that wraps platform ScrollView while providing integration with touch locking "responder" system. Q&A for work. I can use ViewPagerAndroid, but when I put it under a ScrollView component nothing gets rendered. A ScrollView uses a built-in content container that wraps all the views inside. Share. These styles will be applied to the scroll view content container which wraps all of the child views. createRow)} </ScrollView> </>. create ({contentContainer: {paddingVertical: 20}}); ScrollView style defines the outer container of the ScrollView, e. I set the width: '90%', height: '100%'. Render the headings in a Drawer and the DOM in a ScrollView with RenderHTMLSource. ScrollView is a component in React Native that allows you to scroll content in a single direction, vertically or horizontally. If the content in an Animated. Best JavaScript code snippets using styled-components. And also add flexDirection: "row" to the contentContainerStyle so it can stack the items. When true, the scroll view bounces when it reaches the end of the content if the content is larger then the scroll view along the axis of the scroll direction. if its row add props horizontal = true on ScrollView. Photo by Shahadat Rahman on Unsplash. And the cool thing is that the last element is not getting clipped. <ScrollView contentContainerStyle={{ flexGrow: 1, height: '100%'}}> // Add scrollView to all Views on the interface, mainly on the ScrollView component // and height to 100% for the ScrollView component </ScrollView> Answer by Braelynn Frost There is an existing limitation with ScrollView where height cannot be provided directly. ScrollView. Note that this is not an issue on Web,. The property needs to be added in the contentContainerStyle prop instead of the style prop <Scrollview contentContainerStyle={{flex: 1}} Share. Add a comment | Your Answer Thanks for contributing an answer to Stack Overflow!. Keep in mind that ScrollViews must have a bounded height in order to work, since they contain unbounded-height children into a bounded container (via a scroll interaction). Find centralized, trusted content and collaborate around the technologies you use most. After any of them are expanded by a user click, the ScrollView (which is inside a flex layout) expands over the boundaries of the bottom navigator bar. ScrollView. Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display. – I had to build an autocomplete with an RTL scrolling. It prevents me from scrolling more than what is shown in this image. Component that wraps platform ScrollView while providing integration with touch locking "responder" system. ScrollView contentContainerStyle defines the inner container of it, e. There are no other projects in the npm registry using @rrnara/react-native-parallax-header. Improve this answer. I need help to make it consistent in all the devices. Add a. Inside the top view, there should be a yellow view of height 10. Add a comment | Your Answer. The ScrollView is a generic scrolling container that can contain multiple components and views. get ('window'). 1 Answer. So we need to calculate total space or padding that we need to leave for proper card arrangement. I've tried several style settings (percentages, flex) and also tried to change the ScrollView component to a FlatList. the problem I have is when the page load, there is a flat view screen that comes from ScrollView and flat list. With flex: 1, the ScrollView container takes all available space, however this does not include the items positioned absolutely inside it since they are out of the document flow. Keep in mind that ScrollViews must have a bounded height in order to work, since they contain unbounded-height children into. below code works fine where there are only two elements in ScrollView container. Though I've tried, I am unable to find the right permutation of flex properties, style vs. 1. All is well with the following:For some reason, I can't scroll to the bottom of my <ScrollView>. So I wrapped the content in a View and put this View inside ScrollView to make the screen scrollable. The following examples show how to use react-native#ScrollView. The contentContainerStyle prop is a scrollable container inside the parent ScrollView I described above. user12551649 user12551649. create ({contentContainer: {paddingVertical: 20}}); See moreScrollView style defines the outer container of the ScrollView, e. 3: if you want to have a fixed size FlatList put it's height inside style property not contentContainerStyle. below code works fine where there are only two elements in ScrollView container. Webview was inside ScrollView and Webview was taking height greater than ScrollView thats why the ScrollView was stealing the scroll event and I was not able to scroll through the webpage. . Hold the Option key on your Mac keyboard while moving the mouse cursor over the touch surface of the remote control. Improve this answer. . const {width: screenWidth, height: screenHeight} =. . ). container: { flex: 0, alignItems: 'center', paddingTop:. Improve this answer. event takes an array of mappings and extracts values from. I am trying to use ViewPagerAndroid inside ScrollView, but nothing is rendered like this. Formatting has nothing to do with your code, you need to remove the code and add: your package,json, your settings. rendering TabView inside ScrollView, the scene height is higher than screen height, but the ScrollView could not scroll vertically. ScrollView simply renders all its react child components at once. The contentContainerStyle is a prop that is passing to the underlying view that wraps the content of Scroll view. 13. answered May 26, 2019 at 8:31. Every Supabase project comes with a full Postgres database. somehow it is rendered before the first load which runs before both of them. Hi, I deleted the contentContainerStyle and it shows exactly like your pic but without the scrollbar and it. I'm trying to render a horizontal scroll view of clickable photos. map((item)=> <Somthing item={item}/>) } Other components </ScrollView> Share. Component that wraps platform ScrollView while providing integration with touch locking "responder" system. (Note: the automatic linking only works if your React Native project uses version 0. Improve this answer. 9k 19 70 137. By default, ScrollView displays contents vertically, and it is suitable for small lists. I created a snack to show you, @abranhe/stackoverflow-56721203:Type: Partial<IScrollViewProps>. Follow edited Sep 10, 2022 at 11:21. By default, the ScrollView container scrolls its components and views in vertical. I started react-native and I am having a hard time finding how I can load a picture from an uri and show it into two scrollView (seems I need that, one for vertical and one for horizontal scrolls). Having a Scroll View inside another another Scroll View is not a good practice. attrs ( { contentContainerStyle: css`. it is the expected behaviour since you're adding explicit flex to the container of the ScrollView's list making it take the overall height of the screen,. Here are couple of them: 1. This works! It's worth mentioning that contentContainerStyle= { {flex: 1}} will break the scrollview, on the other hand. I'm currently using KeyboardAwareScrollView with react-native-google-places-autocomplete and only when the auto-complete component is within KeyboardAwareScrollView, the drop-down suggested addresses from Google does not respond to presses. This is the POSITION 2, you can see the POSITION 2 in this screen. Creating a cross-platform app. Maybe you can add the currently used version and extensions installed and activated. Collectives™ on Stack Overflow. By the way, this may seem like a hacky way of doing it, but I actually use this method all the time, including in production. container}> <Button title='Block js' onPress={()=> this. The typeahead displays options that overlay other content on the route (see right image below). When I run your code I see the intended behavior (a 500px bounded scrollView). The easiest way is to use the package react-native-keyboard-aware-scroll-view. when the content of TabView is higher than screen height, ScrollView could scroll vertivally. 121 8 8 bronze badges. bind (this)}> <View> <ScrollView> <Text>Hello, here is a very long text that needs scrolling. 1,602 1 1 gold badge 9 9 silver badges 15 15 bronze badges. But in android, We are not able to scroll the. The scrollable items can be heterogeneous, and. but if there are more items they remain in a single row despite giving them a flex: wrap property. <ScrollView contentContainerStyle= { { flexGrow: 1}}>. 19-Oct-2018. ScrollView is using a layout transition, and transitioning from a larger height to a smaller height, the content container within the Animated. The following examples show how to use react-native#ScrollView. we can get screenWidth from Dimensions as shown in below code snippet. contentContainerStyle StyleSheetPropType(ViewStylePropTypes) # These styles will be applied to the scroll view content container which wraps all of the child views. NativeBase 3. styled. This is a page. – Erdenezaya. In that case, it might not be able to identify the gesture. StyledInterface. {js|tsx} file and linking the SDK for both iOS and Android platforms. This sets the flex on the outer container of the scrollview, rather than the inner container. react-native-web. This tutorial explains how to create animation header in scrollview in react native application. My requirement is actually like this 1) Bottom item should be visible -----> It is working fine now Setting flexGrow: 1 to the content container will make the content of the container glow to fill up the full height of the container. ScrollView is using a layout transition, and transitioning from a larger height to a smaller height, the content container within the Animated. Component that wraps platform ScrollView while providing integration with touch locking "responder" system. By using this property it will apply the container wrapping your children (which I believe is what you want in this case) and with the additional benefit of working on both iOS and Android. I have the following Modal which I would like to have its content scrollable when it doesn't fit the screen. I have made hard coded height value 2000px, which is really practice and also FlatList's contentContainerStyle added hard coded paddingBottom 2000(also another bad practice). Pink, red and blue bar have a specific height, they don’t grow to the containers max. Here's the problem: I scroll the WebView without a problem, but whenever I swipe up to go to the top of the page, doesn't matter if I'm on the end, the middle or the beginning of the page, the refreshControl is always triggered. ScrollViewは、限られたサイズのものを表示するのに最適である。 ScrollView内ではスクリーン上に表示されていない要素含め全ての要素がレンダリングされてしまう。So I wrapped the content in a View and put this View inside ScrollView to make the screen scrollable. </Text> <ScrollView> </View> </TouchableWithoutFeedback>. FlatList, on the other hand, is a more optimized version of ScrollView for large lists of data. I'm using expo(not sure if it is an issue here) Here is what I added:I'm using my actual phone for the tests but the result is the same when I use an emulator, scrolling doesn't work. Example: return ( <ScrollView contentContainerStyle={styles. js. Use the ⌘+R. after many try i give up. These styles will be applied to the scroll view content container which wraps all of the child views. StyledInterface. It’s the moving part of the ScrollView, and this is where we’re applying styles that allow us to align the items inside, add padding, etc. The problem I run into now is as follows: If I give the scrollview contentcontainerstyle flexGrow: 1, then the scrolling works as normal, but I cannot give the children sections of the scrollview space dimensions with flex values. Description Child elements of ScrollView are clipped when positioned outside of the ScrollView bounds, even when the style and contentContainerStyle props have been given overflow: 'visible'. Mervzs. Now get the device total width so we can equally divide the width between two cards. Dont use contentContainerStyle on Scroll View Just use simple style prop for styling of scroll View . Use contentContainerStyle props instead of style props. /components/Content. you can use numColumns with FlatList to made some columns in the flat list. ScrollView simply renders all its react child components at once. After i add contentContainerStyle={{ flex: 1 }} into ScrollView, ViewPagerAndroid will render correctly but the whole page will not be able to scroll like this (The whole page can not scroll just FlatList part can be scrolled). One of the reasons people choose contentContainerStyle is because this prop is the only right choice for some stylings of FlatList, for example. 1. We’ll be using it to support our basic authentication flow with email and password. But I already set the height of my dynamic ScrollView to. A couple of solutions of doing this are: Use a minHeight on the ScrollView (but this requires taking into account the screen dimension to render correctly) Use a flexGrow: 1 on the ScrollView contentContainerStyle and a flex: 1 to the inner content: 4. create({ contentContainer: { paddingVertical: 20} });I'm working on a React Native app with a typeahead component. import { Dimensions } from 'react-native'. Click the touch surface in order to interact with the selected element. Because children are limited to the parent's height, so if you assign flex:1 on the scroll-container, it will also disappear if the parent doesn't have. ) (It also means giving enough height to the parent containers of the scroll-container). contentContainer} > </ ScrollView >);. g items alignments, padding, etc. we can get screenWidth from Dimensions as shown in below code snippet. This may cause an issue, with the list of addresses not showing up because of the set styling. Depending on your implementation, doing this will render every other scrollable component, Flatlist, SectionList, unscrollable. Expected behaviour. So you should remove it, and instead you should give the container style enough height to display every item inside:. and just give padding or margin on component if you to center it. blockJS()}/> </ScrollView> Or as a wrapperA way to do this in 2022 would be this: <> <TopMenu /> <ScrollView> {array_with_two_items. 3 to 6 items per row,. When there are more items to enable scrolling. You have noticed in many apps that a fixed height header is positioned on the top of the screen and a scrolling list is used underneath the header. It disables the. Problem definition. contentContainerStyle. current }, }, }, ], { useNativeDriver: true, }, ); When I add both codes togather and called onScoll of scrollview they does not work. If setting contentContainerStyle prop is not a problem for you, you can go that way. When the aut0-complete component is without. Expected behavior. Expected Behavior I'd expect styled components would apply the property to the correct element. react-native. 1. On android when I apply a border radius to a scroll view the inner container ignores the outer border radius and I can't figure out how to make it conform. Considering the issue that you are using fixed height for the header, and flex for the Routes maybe, the orientation for different devices would not scale well and would look weird. If I refresh again it keeps going down and so on. react-native-swiper. The View/List just holds all the different buttons. It disables the. For example1 Answer. This is my style. contentContainerStyle StyleSheetPropType(ViewStylePropTypes) # These styles will be applied to the scroll view content container which wraps all of the child views. . Best JavaScript code snippets using styled-components. However when I add contentContainerStyle when scrolling down in the view, once the finger is lifted off the phone (or release of the mouse in simulator), the scroll automatically goes back to the top. Connect and share knowledge within a single location that is structured and easy to search. 2) based on your current code, it is likely that your content is being hidden behind your tabView, because tabview is inside your scrollView as well, as has absolute position of top: 0, which is where your content. <ScrollView horizontal> <Child/> </ScrollView>. Apply rowGap to a scroll view with multiple children. You can remove the flex property. But it works well went removed horizontal={true}. Inside the bottom sheet the Flat-list does not scroll. Description. 2 Answers. I tried flex: 1, flexGrow:1, add flex:1 to outer views, add contentContainerStyle={{ minHeight: '100%', }}> , but i couldn't make it work. 386 5 5 silver badges 20 20 bronze badges. These styles will be applied to the scroll view content container which wraps all of the child views. In order to bound the height of a ScrollView, either set the height of the view directly (discouraged) or make sure all parent views have bounded height. Configure ScrollView. The useEffect you currently have only executes on mount of the component, as the dep. In that case, it might not be able to identify the gesture. 1: don't put a fixed height for FlatList contentContainer. I changed contentContainerStyle={{ flex: 1 }} to contentContainerStyle={{ flexGrow: 1 }} and now screen can be scroll when keyboard is on. Malik Hamza Malik Hamza. i fixed this problem after some research by adding this contentContainerStyle={{flex:1}}to the scrollview, after that i added more content to the page but it did not scroll, i don't know know why, maybe i might be doing something wrong here is the code for the pageI am new to react-native. I created a snack to show you, @abranhe/stackoverflow-56721203: contentContainerStyleでList内のスタイルを設定する事が出来る。 公式の見解. still the same issue after i replace ScrollView and KeyboardAvoidingView with KeyboardAwareScrollView. Coding example for the question ScrollView child layout must be applied through the contentContainerStyle prop-Reactjs. 6 Output of npx react-native info info. I suspect it might have something to do with ScrollView's contentContainerStyle prop which I set to flexGrow: 1, flexShrink: 1. <ScrollView contentContainerStyle= { { flexGrow: 1, justifyContent: 'flex-end', }}> </ScrollView>. If the colors are accurate in the screenshot, your scrollview is taking up all the vertical space already but the container is not (container background color is white). This results in the content of the scroll view being clipped. scrollToEnd ( {animated: true}) – Erdenezaya. Follow answered Jul 11, 2022 at 8:25. Adding flexGrow:1 to the <ScrollView> component contentContainerStyle prop worked for me (adding flex:1 to the outside <View> or to the <ScrollView> was NOT working for me). ScrollView. Use this data inside flatlist or scrollview and you can classify it according to the type(1,2,3) field. Example: return ( <ScrollView contentContainerStyle={styles. What you need may be KeyboardAvoidingView. So if those content is long. I have tried having the scrollview be inside another view but that still doesn't work. It is cool if I doesn't have to make scroll, but when I have a number of components in the FlatList that forces do scroll to see all of it the scroll start in the center of these. Teams. g items alignments, padding, etc. Here is the example by adding flexGrow to the styles of the ScrollView since it accepts view props. Make sure to check it out! 👈 This cross-platform component is inspired by the iOS-TableView. 2. 948 6 6 silver badges 13 13 bronze badges. These styles will be applied to the scroll view content container which wraps all of the child views. When bounces is enabled, content will bounce horizontally even if the content is smaller than the bounds of the scroll view. Of course you will probably have to refine this tip to your use cases. However, I don't know how to do it. The turkey bar has a flex:1 which cause the container grow to the max, to prevent this behavior you could wrap the elements container with an view and pass the flex:0 style as i did for the black bar. The view keeps staying at the top of the screen. ScrollView. json (of vscode) – Dennis Vash. Related PostsThe main problem was that text font size was too big for the TextInput field, which causes scroll inside the TextInput, so there are 2 solutions: 1) decrease font size 2) make the height of the TextInput field bigger. < ScrollView contentContainerStyle = {styles. 1. depending on your requirement. 59. With the latest 5. ScrollView is using a layout transition, and transitioning from a larger height to a smaller height, the content container within the Animated. The component only provides appropriate styling. Connect and share knowledge within a single location that is structured and easy to search. Imagine you have a very long list of items you want to display, maybe several screens worth of content. On the other hand, this has a performance downside. As it can be seen in the attached screenshot, border acts different between ScrollView and View. I was able to get the beginning spacing correct with paddingLeft on the list, but paddingRight on the list doesn't seem to put any space after it (if I scroll all the way to the end, the last item is pressed right against the border). contentContainer} > </ ScrollView >);. This works perfectly for me on Android and iOS and does not clip the content on the scroll (iOS) if the content does. Learn more about CollectivesThe sentry-wizard takes care of initializing the Sentry SDK in the React Native App. While scrolling the feed, the profile part also should scroll. js: import React, { Component } from "react"; import { ScrollView,I have a main ScrollView for a user profile, and then within that ScrolllView I call a component that is also a ScrollView with the same vertical orientation. Improve this answer. Connect and share knowledge within a single location that is structured and easy to search. I am creating different scrollviews and the view is not correct. disableScrollViewPanResponder: ?boolean. I have a ScrollView which has two children, and I want each of the children to be the full height of the available space on the screen, meaning view 1 fills the whole screen, and then I scroll down to start to see part of slide 2. Haidar Zeineddine. Animated. The bottom element should be at the bottom all the time but when the top two components' height is large they should push the bottom component down so I can use scroll view to move up/down. Hopefully I have provided enough details. Like @MasterTeus said, set padding in contentContainerStyle on your flatlist or scrollview <ScrowView contentContainerStyle={{padding: 20}}>. 22 Platform: Android This works as expe. Now get the device total width so we can equally divide the width between two cards. Keep in mind that ScrollViews must have a bounded height in order to work, since they contain unbounded-height children into a bounded container (via a scroll interaction). Add contentContainerStyle= { {flexGrow: 1}} prop to ScrollView and its children's flex:1 would work. ScrollView contentContainerStyle defines the inner container of it, e. The typeahead displays options that overlay other content on the route (see right image below). Imagine you have a very long list of items you want to display, maybe several screens worth of content. can confirm the same issue on RN@0. The overall structure is something like this: <TouchableWithoutFeedback onPress= {this. <ScrollView contentContainerStyle={{ padding: 10 }}> // User contents here </ScrollView> No need to flex anything. contentContainer}> </ScrollView>);. We set the contentContainerStyle prop to: { flexGrow: 1, justifyContent: 'center', flexDirection: 'column', } to expand the ScrollView to fit the View. That makes it very easy to understand and use. This only happens with the compiled APK. When you start to scroll the list, the header collapses. Therefore you may consider switching it to the flex. Now I would like to pull down a scrollView and refresh this component, so I have followed the official document mentioning onRefresh and RefreshContorol from react-native. create({ contentContainer: { paddingVertical: 20} });3 Answers. You can change it as follows <ScrollView contentContainerStyle={styles. 60 and above. Using React-Native ScrollView is not only the option. Version 0. " After setting flexGrow: 1, justifyContent: 'space-between', flexDirection: 'column' in contentContainerStyle, one can set justifyContent: 'flex-start' for the upper container view with the text, and justifyContent: 'flex-end' for the lower. 2. –ScrollView. FlatList, on the other hand, is a more optimized version of ScrollView for large lists of data. I have a problem with ScrollView. In this example the contentContainerStyle of a ScrollView is styled: const Container = styled. Improve this answer. – iLuvLogix. you can just use this. Straight from React Native docs, for the scroll view's children to be arranged horizontally in a row instead of vertically in a column the only prop you need to use it's horizontal. On the other hand, the contentContainerStyle property allows you to specify styles for the content inside the ScrollView. From the docs: These styles will be applied to the scroll view content container which wraps all of the child views. Unfortunately no results : ( The slider doesn't show up even though I have the formContainer set to height: 800 which should extend below the page. try to remove : styles. 1. here is sncak works fine. Upon reflection, this is exactly what the problem was. So my parent view is scrollview so I can't use FlatList to achieve the above ui. Improve this answer.