With the ListView component in react-native - is it possible to render rows within sections like this?
<section>
<row>A</row>
<row>B</row>
</section>
<section>
<row>C</row>
<row>D</row>
</section>
And not like this:
<section></section>
<row>A</row>
<row>B</row>
<section></section>
<row>C</row>
<row>D</row>
I'm using renderRow and renderSectionHeader.
The reason I want to render like this is due to the styling. But maybe I'll need to have two nested ListView instead?
I can propose a bit hacky solution.
On android to add shadow to secton you can set elevation to all rows and section header. On ios you need to set shadow* styles.
But you will get problem if you will decide to add borderRadius. In this case to prevent top border artifacts you can add small negative marginBottom (-2 or -4 should be enough) to each row.
shadow: {
shadowOffset: {
width: 2,
height: 2
},
shadowRadius: 1,
shadowOpacity: 0.2,
elevation: 2,
borderRadius: 2,
marginBottom: -2,
}
ListView with 3 rows:
Related
I am using Swiper Maniuplation effect which shows multiple slides, but when I click next button I want it to append only one slide, not two slides. This is how I integrate it with Svelte:
<Swiper
modules={[Navigation]}
spaceBetween={20}
slidesPerView={1}
navigation
breakpoints={{
// >= 640px
640: {
width: 640,
slidesPerView: 1,
},
// >= 768px
768: {
width: 768,
slidesPerView: 2,
},
}}
on:slideChange={() => console.log('slide change')}
on:swiper={(e) => console.log(e.detail[0])}
>
{#each reviews as reviewer (reviewer.id)}
<SwiperSlide>
<div class="shadow-md">
{slide.title}
</div>
</SwiperSlide>
{/each}
</Swiper>
How do I solve this issue? Thank you
what do you need to append for, isn't it better to do it with Lazy load and load the previous and next one or just one with loadPrevNextAmount (check documentation)?
I want to acomplish this : https://i.stack.imgur.com/NNrP3.png ,
Current situation is : https://i.stack.imgur.com/s1rI5.png ,
I am unable to create that grayish line over every tab, and my actual orange indicator will go over that gray line when im moving thru my navigator.
Thanks for all the help.
At the end i figure out how to do it and here is an example if anyone have same problem :
tabBarOptions={{
activeTintColor: getThemeColor("white", app.appTheme),
style: {
backgroundColor: getThemeColor("background"),
elevation: 0,
borderBottomWidth:_generalSize(1),
borderBottomColor: getThemeColor('textInputPlaceholder'),
},
I just put inside tabBarOptions style: and then i put normal border botom.
I am working on a vue.js project and I am using the v-charts plugin. I cannot get the legend to display for any of the line graphs I am producing. I am able to produce the appropriate chart with x-axis and y-axis labels and a title for the chart. I have tried altering a ton of different options for the legend. I have also imported the legend component for e-charts individually.
I have tried multiple different formatting options for the legend.I have started a new project without any styling and still no luck. I'm sure there's something simple going on with my options object but I cannot figure it out.
Has anybody else ever run into this and found a solution?
I have been using this site as a resource for years and never asked a question. I can't figure this one out.
The chart options bar is being set in a function and the data is represented appropriately on the graph. I just need to be able to display the legend.
Code snippets and screenshot of graph below:
<template>
<div class="standard_div">
<!-- Begin chart component of graph -->
<v-chart v-if="showChart" :options="chartOptionsBar"/>
<!-- End chart component-->
</div>
</template>
<script>
// Import a different instance ECharts into the .vue file.
import ECharts from 'vue-echarts';
import 'echarts/lib/component/legend'
import 'echarts/lib/component/title'
</script>
chartOptionsBar = {
xAxis: {
// The data for the series
data: this.xAxisSeries,
// Parameters for the x axis
name: this.x_axis,
nameLocation: 'middle',
nameTextStyle: {
padding: [20, 20, 20, 20],
fontWeight: 'bold',
}
},
yAxis: {
// Parameters for the x axis
name: this.y_axis,
nameLocation: 'middle',
nameTextStyle:{
padding: [25, 25, 25, 25],
fontWeight: 'bold',
}
},
series: [
{type: 'line', data: this.yAxisSeries},
],
legend:{
top: 'auto',
left: 'auto',
right: 'auto',
bottom: 'auto',
width: '50%',
orient: 'horizontal',
lineHeight: '56',
padding: 25,
type: 'plain',
zlevel: 20,
data: ["item0"]
},
title:{
show: true,
text: this.graphTitle,
x: 'center',
textStyle: {
fontSize: 20,
}
},
};
The link includes an image of the graph that was produced from the options bar above.
I had the same problem and importing the legend using
import 'echarts/lib/component/legend'
in my component worked for me!
Try to play with positioning props
im using drop down menu https://shoutem.github.io/docs/ui-toolkit/components/dropdown-menu
by default it is set to be transparent last items in the menu, i was wondering if i can disable it since im only using 2 items in the menu and it makes my second item to be transparent and hardly be seen.
when i click my drop down menu and you can see the 2 items there (second is barely seen)
I'm afraid this cannot be disabled by a simple bool prop or similar. This option will likely be something that is added in the future. For now, i would suggest you try to edit the theme for the UI toolkit.
If you're using the Shoutem platform, you could create a custom theme that you could use in your app ( as a new custom extension ). If not, you could define your default UI toolkit theme manually, where you would "disable" this gradient.
In both cases, you would need to override the DropDownModal component theme styles.
This is the default theme style that is passed to the component.
'shoutem.ui.DropDownModal': {
modal: {
'shoutem.ui.Button.close': {
'shoutem.ui.Icon': {
color: changeColorAlpha(variables.subtitle.color, 0.5),
fontSize: 24,
},
position: 'absolute',
bottom: 25,
left: 0,
right: 0,
},
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingVertical: 20,
backgroundColor: changeColorAlpha(variables.backgroundColor, 0.97),
},
....
},
You could define a new theme for the toolkit that overrides this specific style property. So you could pass in something like
'shoutem.ui.DropDownModal': {
modal: {
backgroundColor: 'transparent',
},
},
We're using the backgroundColor property to style the overlay above the actual dropdown.
If you're not using the Shoutem platform, you can make use of getTheme, that is exported from UI toolkit to get the default theme. This will provide you with resolved style object, into which, you can merge your changes from above. Then, just set the new theme as the current one, by making use of #shoutem/theme;
import { Theme } from '#shoutem/theme';
Theme.setDefaultThemeStyle(myCustomTheme);
If you're using Shoutem platform, you could create the same override, by creating a new theme extension, that merges default styles from the Rubicon theme extension.
I am using line chart for showing data. It working absolutely fine but if my data has negative value in that condition my chart is cutting from bottom.
You can see my error in above image which marked with red color.
I used react-native-pure-chart - below link :-
https://www.npmjs.com/package/react-native-pure-chart
<PureChart type={'line'}
numberOfYAxisGuideLine={0}
data={this.state.sampleData}
width={'100%'}
height={72}
backgroundColor={'#2c3554'}
color={'#2c3554'}
/>
My data is [10,-2,6]
Please help me. Thank you in advance
I got the solution.
Use react-native-svg-chart (Linechart).
It will solve the issue.
Below is my code :-
import { LineChart } from 'react-native-svg-charts'
<LineChart
style={{ flex: 1, marginLeft: 4 }}
data={this.state.sampleData}
svg={{ stroke: 'rgb(211, 234, 250,0.7)' }}
contentInset={contentInset}
/>